Curve tilt based on curvature

Hi there.

I’m trying to model something like a motorcycle trajectory: a curve that leans into the curve the closer it gets to the apex. So far, I can do this manually by setting the curve-tilt of specific vertices. But I want to automate this process with geometry nodes.

I think what I need to do is compute tangent differences between adjacent vertices on the curve and use that to set the curve tilt appropriately. But I can’t figure out how to do this. Any suggestions? I’ll attach my blend file and screenshots of what I’m trying to do.

  1. Here is what I can do by manually adjusting curve-tilt:


    I am able to make the curve lean inwards at the apex of the bends while all other regions are vertical. The tilt gets interpoltaed everywhere else in between giving smooth bends.

  2. Here is me with a similar setup with geo nodes.


    I want to accomplish the same effect, but automatically. My idea is to compute the difference in tangents between adjacent vertices of the curve. If the curve bends, the tangent difference will be large, and I can use this to tilt the curve more at that point. That means it will automatically remain vertical when two vertices have parallel tangents, such as in a straight line. But I have no clue how to implement this. I’ve tried looking around but to no avail. Please help.

Blend file

See if this helps…

Or perhaps the vector viewer tutorial that he put out not long before this one.

They should give you the node logic you need.

1 Like

This really looks like what I need! Thank you.

I’ll work on it and update the forum

Hi,

So I managed to get it to work with some modifications:

Instead of using normals and computing arccosines, I used tangents and computed the arctangents. This is because arccosines do not maintain the sign of the angle i.e. whether the vector ahead tilts to the left or right. This can be retrieved by using arctan instead. But Blender does not have this yet for 3D input vectors. Luckily, implementing it is not so bad. Here is the explanation.

Here is what the arctan implementation looks like in Blender Geo-Nodes:


One important distinction is that you do not need to use the z-component of the vector. For me this works out better, but for anyone else reading this, you may have to dig into the math a little more to get the effect in z ( I doubt the angle between 3 vectors can be defined- but who knows. linear algebra makes hyperdimensions seem like trivial math )

Anyways, I have one more minor issue. If I scale the tilt so that the influence from the angle is more, the profile starts to crimp:

I tried combinations of subdividing, applying scale, dissolving the apex vertex, resample curve node- nothing helps. The only solution is to pull the adjacent vertices of the apex further apart.

Any suggestions?

Thanks in advance