added keyboard binding to simulate viewer movement
This commit is contained in:
parent
fda3502870
commit
736e1c46a3
2 changed files with 9 additions and 5 deletions
|
@ -55,8 +55,8 @@ fn main() {
|
||||||
.add_startup_system(setup_threaded_tracker)
|
.add_startup_system(setup_threaded_tracker)
|
||||||
|
|
||||||
.add_plugin(CameraProjectionPlugin::<OffAxisProjection>::default())
|
.add_plugin(CameraProjectionPlugin::<OffAxisProjection>::default())
|
||||||
.add_system(simulate_viewer_with_circle)
|
// .add_system(simulate_viewer_with_circle)
|
||||||
// .add_system(simulate_viewer_with_keyboard)
|
.add_system(simulate_viewer_with_keyboard)
|
||||||
.add_system(apply_viewer_to_projections)
|
.add_system(apply_viewer_to_projections)
|
||||||
.add_system(toggle_fullscreeen)
|
.add_system(toggle_fullscreeen)
|
||||||
.run();
|
.run();
|
||||||
|
|
|
@ -81,14 +81,18 @@ pub fn simulate_viewer_with_keyboard(
|
||||||
input: Res<Input<KeyCode>>,
|
input: Res<Input<KeyCode>>,
|
||||||
time: Res<Time>,
|
time: Res<Time>,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
let offset = Vec3::new(0.0,0.0,8f32);
|
||||||
|
|
||||||
for mut viewer in query.iter_mut() {
|
for mut viewer in query.iter_mut() {
|
||||||
if input.pressed(KeyCode::W) {
|
if input.pressed(KeyCode::W) {
|
||||||
viewer.position += Vec3::Z * time.delta_seconds();
|
viewer.position += Vec3::Z * time.delta_seconds();
|
||||||
} else if (input.pressed(KeyCode::S)) {
|
} else if (input.pressed(KeyCode::S)) {
|
||||||
viewer.position -= Vec3::Z * time.delta_seconds();
|
viewer.position -= Vec3::Z * time.delta_seconds();
|
||||||
|
} else if input.pressed(KeyCode::A) {
|
||||||
|
viewer.position -= Vec3::X * time.delta_seconds();
|
||||||
|
} else if input.pressed(KeyCode::D) {
|
||||||
|
viewer.position += Vec3::X * time.delta_seconds();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue