# Get rotation change along the spline point

The above is a brilliant visualisation! Thank you. The red bit is the actual forward vector of the rotation and it’s probably quite different from the original mesh’s rotation that you read manually and added to the array.

I think you’ll have a couple of options.

• are we making 10 splines like this
• are we making a 1000 splines likes this
1 Like

Thank you for the recommend!
So i have to create a spline for each mesh location if i want to get the specific rotations.

No, it’s not a recommendation. I am asking. How many of those splines do you want in the final product.

• if you only need around 10 or so, we can come up with an easy manual method
• if you need a 1000… that would take too much time to do it manually, we’d need another method
1 Like

I think i don’t need to 1000 just a animation to simulate the ship moving to a port.
So we can come up with an easy manual method.
But if you have a method to get to 1000 splines, it really nice if you tell me just in case i need to use it later!!

Lets see if this works for you:

Note how the rotation of the ship is different from the rotation of the forward vector of the spline point. This creates the illusion of the object predicting where it needs to turn ahead of time - as if a race car was drifting along a track.

And that’s what is being done above, we’re sampling the rotation 10% ahead of us and apply it instead of our current one.

• this is fully automated
• I did not need to place / rotate any meshes
• I did not need to create an array of points / rotations
• I placed the spline points in the world, adjusted some
• and you can, of course, modify those points’ tangents to get the right feel for a particular turn

This 1.1 multiplication on its own is not ideal but it can be turned into a more clever algorithm that predicts proper turns. You could account for velocity for example.

1 Like

So here’s a thing that should fit into your existing system:

• create and use locations any way you need:

• but rotations are manual, added to an array (just like your meshes):

• we interpolate between them independently of what the spline is doing:

• we query rotation at array index associated with the point we’re closest to and the next index / point
• we need to create an alpha value to drive the lerp, so I measure our progress along the spline in relation to the 2 points mentioned above
• optionally, you can use an extra curve to alter the behaviour

There’s probably a couple more methods to achieve the effect.

Hope it helps and good luck!

1 Like

Hello I just tested it.
And it work like a champ !!!
This is what a need for my situation to get the rotation at spline point.
I really appreciate your patient with a newbie like me.
Thank you!