Final path3D position and rotation

How can we make the final Path3D position and rotation the same as the initial of the mesh (box)?

:warning: double click to start animation

Hello! The last argument of the Catmull-Rom creation function allows you to make a closed curve: Curve3 | Babylon.js Documentation (

1 Like

Hey @carolhmj , I tried this one before posting, but the initial/final position of the catmullRom changes (should be the same as the mesh):

And, most of the time, the final rotation don’t match with the initial one:

If we remove the rotationAnimation, without closed curve looks perfect:

I think the problem is how to rotate from 0 to any and return to 0 at the end:

  • 0...1, 3, 2, 1...0
  • 0...N...0

Hmmm then you’ll need a method to match the initial and final tangents of the curve (as the rotation is derived from them). I would possibly look into using a different type of curve for that that allows you to explicitly define your tangents, like the Hermite Spline: Drawing Curves | Babylon.js Documentation (


:open_mouth: I haven’t tried this one. Thanks

Space-Truckers had to solve this problem - it plagued me a long time indeed! See The code repos and look in the driving screen code for specifics

In that case, I started with a collection of point and corresponding world-absolute rotations and used Path3D along with a matrix rotation to project points around the path into a tube or a tunnel using Mesh.createRibbon.

When you create the Path3D it’s important to both note that the path represents points as floats between 0 and 1, and to pass appropriate parameters in the constructor to interpolate as needed and/or normalize points. Take care to decide whether you’ll want to work in local or world space xforms and check that you’re properly converting between where indicated

HTH - not at my laptop so a bit tough to get PG links, sorry!


Pretty neat, @jelster! You have a heavy cargo. I’ll take a look at the load on these trucks :truck:
Thanks man.