# How can I rotate individual curve points in geometry nodes?

I am building a railroad simulation: The simulation is based on a spline around which everything revolves. One of the problems I have is turning the rails to the left or right, although I can do it manually that way: The curve I get does not have a uniform curve angle (it does in real life, except in some special cases).

So my question is: Suppose I have a straight spline with seven vertices. I need to rotate vertices number 3, 4 and 5 by $$5°$$ each in the Z axis. The rest will stay aligned with the changes.

Is this possible?

Example: I also need the ability to control which vertices I rotate and in which dimensions they rotate.

For example, is it possible to make outputs with the ID of the vertices where the curvature starts and where it ends? • it would be nice if you could improve and clarify your question a bit. At what axis do you want to rotate? tangent? what is your end goal? (because often things could be solved easier and quicker if we know what your end goal is) Oct 2, 2022 at 17:13
• I agree with @Chris: it is not clear what you want to achieve. If you rotate a point around itself, its position does not change. Therefore it needs a point of rotation (pivot point). Where is it located? What exactly is your goal? Can you please explain this in more detail? Oct 2, 2022 at 17:52
• It looks like OP wants to control curve twist. Oct 2, 2022 at 17:58
• @MarkusvonBroady ...you mean curve tilt? Oct 2, 2022 at 17:58
• After edit the question is really no longer about "rotating vertices" (it never made a lot of sense to begin with), now it's about rotating all the control points after a given vertex, around that vertex. This can be done, but since geometry nodes don't have loops, really the only way to rotate around multiple vertices is to apply the rotation multiple times, or to use an accumulate field to hold previous vert's position and rotation state. Oct 3, 2022 at 12:15

Now that it is clear what exactly you want to do, I have the following suggestion for you: • Here I first select the desired points.
• Then I accumulate the desired angle at the selected points.
• At the same time I calculate the direction vector between the points.
• Then I rotate this direction vector per point with the accumulated angles.
• And finally I accumulate these direction vectors and get the new position.

Set Curve Tilt is the node you want to use. Below I'm using a color ramp to easily control each vertex twist - for readability I keep the color ramp output within the "visible" range of $$[0..1]$$ color values, and then multiply it by $$360°$$. So in order to twist the vertices 3, 4, 5 by $$90°$$, I've set their colors to $$0.25$$ ($$0.25 × 360° = 90°$$).  If that's too complicated, you can just directly input the radian twist values into the color ramp, even if they are above $$1$$ (but they can't be below $$0$$). You can also input the twist values in degrees, and then pass that through To Radians node...

Keep in mind this technique works for up to 32 vertices as that's the limit of a color ramp. If you have more vertices, you probably don't want to control them all manually and instead take care of color ramp's gradients or some maths... If you have a lot of vertices, but want to control only up to 32 vertices' twist, you can access them by index using the below technique:

Cycling /looping through a set of index values using geometry nodes to create animation

• I know you love the Color Ramp ;-) +1 Oct 2, 2022 at 18:35
• @quellenform not really, it's slow and inaccurate, but it's the easiest setup for mapping 😜 Oct 2, 2022 at 18:36