better movement, floor and exit with escape
This commit is contained in:
parent
2ce1d6e809
commit
374ea20d5b
2 changed files with 10 additions and 2 deletions
|
@ -18,7 +18,7 @@ impl Default for FlyCamera {
|
|||
fn default() -> Self {
|
||||
Self {
|
||||
speed: 1.5,
|
||||
sensitivity: 3.0,
|
||||
sensitivity: 6.0,
|
||||
friction: 1.0,
|
||||
pitch: 0.0,
|
||||
yaw: 0.0,
|
||||
|
@ -76,7 +76,7 @@ fn camera_movement_system(
|
|||
|
||||
let rotation = transform.rotation;
|
||||
let accel: Vec3 = (strafe_vector(&rotation) * axis_h)
|
||||
+ (forward_walk_vector(&rotation) * axis_v)
|
||||
+ (forward_vector(&rotation) * axis_v)
|
||||
+ (Vec3::unit_y() * axis_float);
|
||||
let accel: Vec3 = if accel.length() != 0.0 {
|
||||
accel.normalize() * options.speed
|
||||
|
|
|
@ -44,6 +44,14 @@ fn init(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// create a floor
|
||||
commands.spawn(PbrBundle {
|
||||
mesh: meshes.add(Mesh::from(shape::Plane { size: 10. })),
|
||||
material: materials.add(Color::rgb(0.5, 0.9, 0.9).into()),
|
||||
transform: Transform::from_translation(Vec3::new(0.0, -3.0, 0.0)),
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
|
||||
fn exit_game_system(keyboard_input: Res<Input<KeyCode>>) {
|
||||
|
|
Loading…
Reference in a new issue