Calculate speed or acceleration from Path3D

Hi Folks,

I’ve seen something intriguing in the Path3D documentation:

Optional raw: boolean
(optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.

I’m trying to understand how that would work. I have a Path3D object and I can see it’s tangents, normals and binormals, but if I add the raw=true option all I see is that the normals and binormals are no longer calculated.

I have a playground example here https://playground.babylonjs.com/#2DLXYB#285.

Ideally what I’m trying to achieve is how to calculate lateral acceleration as I’d like to control the roll of an object following this Path3D (based off the excellent example mentioned in How to control/smoothen the rotation of an object moving along a 3D Path?) - so essentially I’d calculate lateral acceleration and then adjust the object’s roll based on that (so it leans into corners in a realistic way).

Thanks, Tom

new BABYLON.Path3D(catmullRom.getPoints(), raw=true); is not a javascript syntax (although I’d like to have it!).

Try new BABYLON.Path3D(catmullRom.getPoints(), undefined, true); instead

Ugh, sorry, switching between javascript and python once too often!

So I’ve changed that but I’m not sure I understand the effect it’s having. Can you give me a hint as to how this helps determine acceleration?

I don’t know how to calculate speed/acceleration from normal/tangent…

What I would do to calculate speed S0 at position X0 on the path is to subtract X0 from X1, where X1 is the next position on the path. This difference is proportional to the speed, so you can multiply it by a constant factor to get it in the desired range. To calculate acceleration, I’d do S1-S0.