Set rotation directly for now.

This commit is contained in:
Nolan Darilek 2024-03-24 16:12:11 -05:00
parent 0a28702b2a
commit 91166359e2

View File

@ -147,7 +147,7 @@ fn controls(
Option<&BackwardMovementFactor>, Option<&BackwardMovementFactor>,
Option<&ForwardMovementFactor>, Option<&ForwardMovementFactor>,
Option<&StrafeMovementFactor>, Option<&StrafeMovementFactor>,
&Transform, &mut Transform,
Option<&mut KinematicCharacterController>, Option<&mut KinematicCharacterController>,
)>, )>,
exploration_focused: Query<Entity, With<ExplorationFocused>>, exploration_focused: Query<Entity, With<ExplorationFocused>>,
@ -161,7 +161,7 @@ fn controls(
backward_movement_factor, backward_movement_factor,
forward_movement_factor, forward_movement_factor,
strafe_movement_factor, strafe_movement_factor,
transform, mut transform,
character_controller, character_controller,
) in &mut query ) in &mut query
{ {
@ -208,7 +208,6 @@ fn controls(
} else { } else {
// println!("{entity:?}: SetLinearVelocity: {velocity:?}"); // println!("{entity:?}: SetLinearVelocity: {velocity:?}");
actions.press(&NavigationAction::SetLinearVelocity); actions.press(&NavigationAction::SetLinearVelocity);
actions actions
.action_data_mut_or_default(&NavigationAction::SetLinearVelocity) .action_data_mut_or_default(&NavigationAction::SetLinearVelocity)
.axis_pair = Some(DualAxisData::from_xy(velocity)); .axis_pair = Some(DualAxisData::from_xy(velocity));
@ -271,7 +270,11 @@ fn controls(
.value = 0.; .value = 0.;
} }
if actions.pressed(&NavigationAction::SetAngularVelocity) { if actions.pressed(&NavigationAction::SetAngularVelocity) {
velocity.angvel = actions.value(&NavigationAction::SetAngularVelocity); // velocity.angvel =
// actions.value(&NavigationAction::SetAngularVelocity);
transform.rotation *= Quat::from_rotation_z(
actions.value(&NavigationAction::SetAngularVelocity) * time.delta_seconds(),
);
} else if actions.just_released(&NavigationAction::SetAngularVelocity) { } else if actions.just_released(&NavigationAction::SetAngularVelocity) {
actions actions
.action_data_mut_or_default(&NavigationAction::SetAngularVelocity) .action_data_mut_or_default(&NavigationAction::SetAngularVelocity)