Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Zesprite |
I set up a scene with a enemy witch is fallowing markers 3D with a navemesh. I want to implement root motion, but when i do so my enemy doesn’t move any more.
Here a part of the code i made witch is working:
func MoveForBorne(delta,speed):
var targetPos = NavAgent.get_next_path_position()
var direction = global_position.direction_to(targetPos)
faceDirection(targetPos)
velocity = direction*speed
move_and_slide()
And here the code with root_motion:
func MoveForBorne(delta,speed):
var root_motion = $AnimationTree.get_root_motion_position()
var targetPos = NavAgent.get_next_path_position()
var direction = global_position.direction_to(targetPos)
faceDirection(targetPos)
velocity = root_motion*direction*speed
move_and_slide()
thank you for reading