chore: adjusted rotation code
This commit is contained in:
parent
dc34e86391
commit
fcc5132223
1 changed files with 3 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include "player_movement_action.h"
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "macros.h"
|
||||
|
||||
void PlayerMovementAction::_bind_methods() {
|
||||
|
|
@ -20,8 +21,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()) {
|
||||
get_blackboard()->get_character()->look_at(get_blackboard()->get_character()->get_global_position() + velocity);
|
||||
character->look_at(character->get_global_position() + velocity);
|
||||
}
|
||||
get_blackboard()->get_player_body()->set_velocity(velocity);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue