iTweenPath auto keep on terrain

Hello everyone.

I’m using iTweenPath a lot, but I’m having a bit of trouble.

Right now, when I set a path, the gameobject is moving in the air.

I know I can make it move correctly along the terrain by placing the path nodes precisely on the terrain, but that will take a long time sense I have a long path and a really uneven terrain.

I was wondering if there might be a way to auto adjust the postion of the gameobject while it’s moving along the path.


You could place and empty game object on the path and make your visible object a child of the empty game object. Each frame, you could raycast down to determine the elevation of the terrain and adjust the ‘y’ value in the visible objects in the transform.localPosition.