# Wheel speed (rpm)

## Recommended Posts

Wonder how to solve this.

I need to spin a wheel. Well, parent it to a null, set keyframes for the angles on the null with certain degree values and it's spinning.

But if I want to have something like an rpm control. Set it to 0 on frame 0 and add frame 240 it's already 400. How is this done?

When I need to rotate stuff in SI I did come up with a wired number of nodes. Each node was incrementing the current angle at a point in the timeline. This way I could calculate on which frame the object would have which speed and which angle to the camera. But this was very complicated and I needed to use nodes like in an attribute vop.

So, though spinning an object seems to be trivial, it isn't.

Anybody some stuff to point out or any tips?

Cheers
Tom

##### Share on other sites

Huh, I'm not sure I understand you very well. But there is at least thre conceptually complete different  approaches to that.

1. Fastest, computation approach.using some expression like WheelAngle = \$T * ch("../YourKeyedCurve") * \$SomeCoefitient

this way your curve represent angles which are simply scaled by time factor and some constant. It is not accurate and can not handle accurate speed changes over time but in some simple cases it can finish the job

2. If your driver curve represent RPM, you need a solver because angle at some point in time depends on value of RPM at that time and current angle from previous time.

In Solver you have to put

@WheelAngle += 360 * ch("../rpm")/ 60 / \$FPS

that way you update wheel angle at every time step with appropriate RPM value from that time step, etc.

3. If your Null (which is parent of wheel) moves through space you can plot curve of that motion by making point trail of that point (null) motion and connect them into curve. That way you generate the path. Assuming your wheel should roll on that path you can calculate length of that path at each frame. That length represents the path wheel already passed. If you know radius of wheel then its  perimeter=2^r*Pi. Dividing current path length with that perimeter you actually get current rotation angle.

##### Share on other sites

Thanks so much for you input!

I guess the solver approach is pretty close to what I did in SI, just with a slightly different approach. But in summary, both methods add a certain angle each frame to an already existing angle.

I wondered if there could by a method which integrates somehow a curve function (rpm/time) and spits out the according total angle without using a solver.

While my current "project" will be totally fine with the way you suggest, there are for instance product shots in which I want the product to spin for a few times, then slow down to stop at a certain angle. Haven't found a really good solution for this kind of stuff, yet.

##### Share on other sites

Yes,

you can skip solver (as the easiest method for any kind of integration) and do your manual integration inside of a loop by using ch("../rpm", NNN) to fetch value from rpm curve at any given frame NNN. This way your loop have to integrate from scratch at every frame (not so efficient)  but can finish job.

##### Share on other sites

Also you can use builtin mechanisms for simple integration. Your example can be solved by area integral (integral of first order) over RPM (rotations per minute) curve.  Here is an example using CHOP for integration. Example is without scaling factors 2*r*PI and without conversion minutes to frames. It is fast enough and allow you changing RPM curve during playback

## Create an account

Register a new account