3D: Movement along navigation path is very jittery:(

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Macryc

Hi All. In a point-and-click setting with raycasts and navigation paths, the movement of the Kinematic Body is extremely jittery. Not all the time, but every other time. I’m using the navigation node with navigation mesh and getting simple path and turning the difference into a movement vector. I’ using move_and_slide to move the kinematic body along the vector. My setup is similar to this one. (you can see jittery movement in the video)

Is there a fix to this? Something in the settings of the navi mesh perhaps?

You could try to smooth out the movement using one of the following ways:

  • Implement constant friction by multiplying the velocity with a value lower than 1 every frame, and add velocity rather than setting it every frame. This is a basic way of implementing smooth movement, but it’s not the most robust one (more information).
  • Use the Tween node to create smooth movement. This may not be a good idea with PhysicsBodies though.

Calinou | 2020-03-27 08:19

and add velocity rather than setting it every frame.

This looks interesting. How do I do that with move_and_slide? I’ve already multiplied velocity by 0.9 and it does seem to have helped a little - the movement is still momentarily sporadic but not nearly as bad as it was before (and still not close to what I’m used to seeing with godot).

Use the Tween node to create smooth movement

The problem here is that you can tween between start and end positions, which looks great, but ignores the navigation path and doesn’t work with collisions. The movement is silk smooth but the character gets stuck when it hits an obstacle (as opposed to ‘walk around it’), also, it will happily tween itself outside of the navi mesh if that’s where you click…

Macryc | 2020-03-27 10:43