![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | SqrtTwo |
How can I make a kinematic body that follows a path walk over a non-flat surface? Because whenever the character has to follow a path it seems to ignore every collision there is.
Section of the code as for now:
func _physics_process(delta):
if pathnode < path.size():
var direction = (path[pathnode] - global_transform.origin)
if direction.length() < 1:
pathnode += 1
else:
move_and_slide(Vector3((direction.normalized() * speed).x,0,(direction.normalized() * speed).z), Vector3.UP)
translation.y == rc.get_collision_point().y
Update: Setting the y axis to 0 in the direction variable seems to make it work properly.
SqrtTwo | 2021-04-07 01:16