# Continuous rotation in AN with certain control behavior? (Speed)

My Goal is a continuous rotation of an object in Animation Nodes around on the z-axis that can be controlled via a value in the way that 0 means no rotation and 1 means certain speed. -1 would be reverse.

Increment values, reassign values?
My understanding of AN got tested in this case really hard. First of all the Rotation Input by default doesn’t use the Object Transform Output as a new Input, is there a way? Second of all is there a way to “store” values or “reassign” them to get this certain kind of behavior.

My First idea was to simply do it with a time_info but multiplying the time_info, logically prouces reverse motion on curve descend. Demo File is 2.81

Comparison to Unity C#
Coding this behavior in unity and c# is easy, because of its incremental fashion: Every tick I can use the current rotation as new input and decide whether I want to add or subtract a certain amount. In AN the linear Time_Info Curve gets multiplied and clinched as a whole.

help would strongly be appreciated! :)

• You want a rotation and your input is a speed curve? Correct? Apr 21, 2020 at 9:34
• @Leander yes, this is the case. Maby its simple, but i cant get my head around it.
– A M
Apr 21, 2020 at 9:35
• as seconed option to this idea of reassigning values, i now thought about differential equations, because it seems a speed curve would be in this way connected to the rotation-value curve. math it not my stongsuit, so maby im wrong..
– A M
Apr 21, 2020 at 9:55

To be able to properly animate in Blender, it is important that frames can be evaluated indepedently without the need for a previous frame or start frame. (Sometimes you want to change the start frame, but frame X should still show the same content.)

Create an empty object, which controls the speed. I added and empty circle and keyframed its X-axis. Grab that Fcurve with Animation nodes.

The position on a frame is merely the accumulation of the speed-value on all previous frames.

To simplify the matter

• I use a starting position of 0
• interpret the input speed value [from the fcurve] as speed per frame
• ignore the subframes (no differential equations) and pretend the speed to be constant for the duration of a frame

but you can easily add the first and second bullet points.

This means we have to get a list of speed values up to the current frame. For that, I use a loop with as many iterations as the current frame number and evaluate the speed-fcurve's value. The resulting list must be summed to get the actual value. I use it to control the X position of a cuboid.

With movement on multiple axis this actually the same.

Final note, do not go the math routes. Although I don't know your context, integrals are most likely overkill.

• thank you very much, really a great answer! Very much appreciated :)
– A M
Apr 21, 2020 at 10:15
• to sum up the list i used the "reassign loop parameter", in case someone has a similar problem.
– A M
Apr 21, 2020 at 10:46