-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
468 additions
and
186 deletions.
There are no files selected for viewing
Binary file not shown.
41 changes: 41 additions & 0 deletions
41
crates/beet_examples/src/components/keyboard_controller.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use bevy::prelude::*; | ||
|
||
#[derive(Component, Reflect)] | ||
#[reflect(Default, Component)] | ||
pub struct KeyboardController { | ||
pub speed: f32, | ||
} | ||
|
||
impl Default for KeyboardController { | ||
fn default() -> Self { Self { speed: 3. } } | ||
} | ||
|
||
pub fn keyboard_controller( | ||
time: Res<Time>, | ||
keys: Res<ButtonInput<KeyCode>>, | ||
mut query: Populated<(&mut Transform, &KeyboardController)>, | ||
) { | ||
for (mut transform, controller) in query.iter_mut() { | ||
let mut direction = Vec3::ZERO; | ||
if keys.pressed(KeyCode::KeyW) { | ||
direction -= Vec3::Z; | ||
} | ||
if keys.pressed(KeyCode::KeyS) { | ||
direction += Vec3::Z; | ||
} | ||
if keys.pressed(KeyCode::KeyA) { | ||
direction -= Vec3::X; | ||
} | ||
if keys.pressed(KeyCode::KeyD) { | ||
direction += Vec3::X; | ||
} | ||
if keys.pressed(KeyCode::KeyR) { | ||
direction += Vec3::Y; | ||
} | ||
if keys.pressed(KeyCode::KeyF) { | ||
direction -= Vec3::Y; | ||
} | ||
transform.translation += | ||
direction * controller.speed * time.delta_seconds(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 0 additions & 83 deletions
83
crates/beet_spatial/src/inverse_kinematics/ik_2dof_transforms.rs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.