Using LinLinV and wheel radius to get rpm then applying x rot per frame?

how can I use a cars LinV to get the wheel rpm using circumference?

how do I use this to apply a rotation 1 time per frame?

basically, how do I get Rotation per frame in radians?

velocity/circumference will give you rotations per unit of time (usually seconds, but this is not necessarily true if you don’t have the Use Frame Rate option checked). You can convert that from rotations/sec to rotations/frame by dividing it by your current frame rate. If you want it in radians, just multiply by 2π.

However, this is only true for a non-turning wheel or a wheel that is in the center of your vehicle. In real life during turns, the inside and outside wheels will have slower and faster RPMs respectively since they have to cover shorter and longer distances with respect to the center of the vehicle.

it looks like I have to divide by 2*3.14 not multiply, (I could be wrong)

but this looks best so far (just about perfect!)

Thanks Mobious!

Attachments

RayRider5.blend (610 KB)

I don’t think your implementation is correct. It looks like you forgot to divide the RPM by 60, and it just so happens that 2π / 60 is close enough to 1 / 2π for your implementation to still look correct.

I think I am getting RPF (rotations per frame)

as LinV is in Distance per frame?

I am not 100% sure though

Linear velocity is given in units per second when you have the Use Frame Rate option checked. I don’t know what unit of time is used when it’s not checked.

To convert from units/sec to units/frame, you need to divide by your current frame rate which is 60 fps (or if you want to be more precise, use the getAverageFrameRate() method).

Wheel.children[0].applyRotation((0,0,(-Wheel.children[0][‘RPM’](23.14))/(60)),1)

looks spot on,

thanks Mobious!

Glad to hear you’ve got it working. Just a thought: would it be better to keep track of delta time/frames yourself? I was wondering what the wheels would look like if the frame rate drops below 60, but your calculations continue to assume it’s 60 fps.

You could always make it frame independent by using delta time. So if you’ve got your velocity in meters per second, you can then measure how long that frame took and use that to determine how much the wheel should have turned. Ie: (velocity/circumference) * deltaTime * 2π. So if the wheel would complete 30 rotations a second and the frame took 0.016ms to render in that frame it would have completed 0.48 turns, or 3.015 radians, slightly less than half a turn.

I hope my maths is right, it is Friday!