fix: look_at condition for player movement uses flat_velocity
This commit is contained in:
parent
567b6682c6
commit
095b2e2498
1 changed files with 3 additions and 2 deletions
|
|
@ -22,8 +22,9 @@ void PlayerMovementAction::process_movement(bool look_at_movement) {
|
|||
target_velocity.y = velocity.y;
|
||||
velocity = velocity.move_toward(target_velocity, delta * actual_acceleration);
|
||||
Node3D *character{ get_blackboard()->get_character() };
|
||||
if (!velocity.is_zero_approx()) {
|
||||
character->look_at(character->get_global_position() + Vector3(velocity.x, 0, velocity.z));
|
||||
Vector3 const flat_velocity{ velocity.x, 0, velocity.z };
|
||||
if (!flat_velocity.is_zero_approx()) {
|
||||
character->look_at(character->get_global_position() + flat_velocity);
|
||||
}
|
||||
get_blackboard()->get_player_body()->set_velocity(velocity);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue