diff --git a/modules/viscosity/player_movement_action.cpp b/modules/viscosity/player_movement_action.cpp index 007048b6..92884847 100644 --- a/modules/viscosity/player_movement_action.cpp +++ b/modules/viscosity/player_movement_action.cpp @@ -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); }