Closed NewNodeGames closed 5 years ago
@NewNodeGames The player code is really a quick and dirty implementation. :)
If you want the player to stop running when he hits a wall, you could declare a new variable in player.gd
var previous_position = Vector3(0, 0, 0)
and replace the animation control code around line 40 with the following:
if (previous_position-translation).length()/delta > 1:
$Model.anim("Run")
rotation.y = 0.5*PI - h_motion.angle()
else:
$Model.anim("Idle")
previous_position = translation
This way, instead of being controlled by the movement intent, animation depends on the actual movement. It's a quick hack and will need to be modified if you want to add more features (jumping, falling...).
Hope this helps...
Thanks, works perfect.
I really like the control on this project, far better than robot 3D demo, but the character keeps "running" (playing run animation) when is in a wall. This thing will be changed soon or how I can solve in the player script.