Adding rotational Roll to bezier curves

I want to get a bezier curve that has rotational roll. With CFrame.lookAt the x,y angles change but the z axis doesn’t.

Please give me the answer in plainish English I haven’t taken calc or trig(pretty much get trig though).

26 views 0 replies :expressionless: please help me

1 Like

Can you be more specific about the issue, or give an example of what you mean?

Actually had this same question in mind a while ago. I never really got to a point where I was satisifed with the result. If you want something that is automatic it most definitely will require trig and calc.

Imagine the automatic curve in rollercoaster sim.

I saw that and wondered if it would’ve worked if you inverted the line bc it almost looked like a reverse image of what you wanted.
Can you try that for your code and see if it works?

Turns out it’s actually an advanced calculus thing that has scientific papers written on it.
Its called Rotation Minimizing Frames and is a nightmare to implement.
Unfortunately, there isn’t an alternative method to get the smooth turning.
–EDIT–
As soon as I figure out how to do it I will make a post about it.

The parameter that controls the Z rotation is the third parameter the upvector which is default 0,1,0 you can modify it to give add roll to your stuff.

To get a roll based of the actual curve itself rather than doing it manually you need the fancy math.
https://pomax.github.io/bezierinfo/#derivatives
Section 15 of this site explains why you get odd behavior with other methods.

Honestly I might make a 2nd attempt at my bezier curve with roll. I’m wondering if I can do some simple Dot Product to compare each point in the curve with it’s neighbor ahead to calculate how much roll needs to be added.

Again, will need to test this out but it’s just a thought to maybe provide a simple way to avoid complex math which honestly might be best to avoid for performance reasons.

1 Like

I did figure out a simple way to add roll to it, but it isn’t dependent on the curve.
(it more so just gives a maximum roll and then applies it)
You could use bezier paths to get a roller coaster effect with it.

I have a feeling there are multiple ways to solve this problem.

For example for differentiation you could instead use numerical differentiation where you take a point in the curve in the future and subtract it with the current point to get the tangent.

This is what @xZylter has in fact done by adding alpha+0.005

This will get you a result that is close to the tangent of the curve.

However for the roll along this tangent line decided by the normal is undecided in 3d space as there are infinite possibilities which rotate along the tangent of the curve.

The issue with CFrame.new in that post is that by default it will try to match this normal curve to as close to (0,1,0) as possible creating no roll.

Consequently, I suggested modifying the third parameter to try and figure something out.

My method did(I think) the exact same thing.
It just did Cframe.Angles(x,y, math.deg(angle * t) and then took that used that rotation.
If I’m wrong and it isn’t the same thing do you think we can get xZylter’s method to work for this problem?

I’m actually almost done with it.
It took me awhile and I had to get help from my math teacher but it should work for quadratic curves.

1 Like

i’m having some problems w it but if you want to help with it I can give it to you.

I wasn’t able to port it to roblox, but if you want I can give you the javascript for it.