View Full Version : Expression: Wheel Rotation for you
06-29-2003, 11:16 PM
I was sitting at Barnes and Noble yesterday and I came up with what will hopefully be a useful expression for some of you. This should allow you to rig a vehicle so that the wheels will spin at the correct pace for the motion of your vehicle no matter the rotation.H or direction within the X and Z axis (I left out the Y axis because most cars don't travel up and down in the air). So here it is!!
WheelRotation = 360 * ( Circumference of wheel / Distance Traveled ) + ( [ Axle Length * Pi ] / Angle of vehicle rotation on H )
Distance Traveled = Sqrt( [ X Distance ]^2 + [ Z Distance ]^2 )
I'll leave it up to all of you to decide how to apply this to your wheels... You'll need to negate the value of Axle Length * Pi / Angle Rotation.H for wheels on one side and not for the others because this applies to turning the vehicle and will cause the tires to spin faster on the side of the car that is to the outside of the turn and slower on the tires to the inside of the turn. (Ex. If I turn my car to the right, the left tires spin slightly faster and the right tires spin slightly slower to allow it to turn without the wheels skidding along the ground). Well, I hope this helps!!!
06-30-2003, 04:08 AM
cool idea! Thanks :)
06-30-2003, 12:24 PM
yes it looks good
I test another solution with angles instead of pythagore theorem
it works too but only in right line. In curve it becomes crazy:shrug:
it's was something like this :
rotation of the wheels =C+B
Have someone and technique to rotate wheels in a curve path ?
06-30-2003, 12:44 PM
Did you mean to write "A=Pi*wheelCircumference?" I would think you would use A=Pi*wheelDiameter which would then give you the circumference. You have an interesting method for rotating the wheels! I think my method should work on a curvy path... I'm going to test it this morning.
06-30-2003, 12:48 PM
of course it's diameter
thanks for the correction
06-30-2003, 01:22 PM
Heh, no problem... I just caught an error in mine as well... instead of Circumference of wheel / Distance Traveled it should be Distance Traveled / Circumference of wheel
06-30-2003, 01:39 PM
Ok, I just tested the expression on a single wheel so I left out the part that applies to axle length and rotation from the axle turning. Here's what I got to work:
DistanceTraveled = sqrt( ( [wheel.Position.X] * [wheel.Position.X] ) + ( [wheel.Position.Z] * [wheel.Position.Z] ) )
RotateWheels = -360 * ( [DistanceTraveled] / (0.720 * 3.14) )
where 0.720 is the diameter of the wheel in meters, 3.14 is my approximation for Pi and the RotateWheels expression is applied to wheel.Rotation.P for a wheel with the front facing negative Z. I hope this helps!!!
Please note that the rotation will reverse if you cross the origin so make sure if you use this to keep it on one side of the X and Z origins (i.e. use X values from 0 to infinity and Z values from 0 to infinity but not negative X or Z values or vice versa)
06-30-2003, 04:10 PM
So does this work in "world co-ordinates" regardless of where the wheel is in a heirarchy? We are using Wheelie from Worley's Polk collection here (on a show involving many cars) and it has the annoying limitation of being married to frame 0 (as opposed to specifying a start frame). So, it has to calculate history all the way back to 0, which causes scenes to grind to unworkably slow frame rates at high frame locations ( like in the 2000's)and/or with many wheels moving.
If this could work as a substitute that would rock! But the impression I'm getting (and I'm no expressions expert) is that a wheel with this on it would not rotate if it were parented to something that moves instead of moving itself.
06-30-2003, 04:19 PM
hmm, i didn't this plug of worley
but Courtjester expression can be apply with everything in lightwave.
The "distance traveled" can be obtained by the wheel or a null or another part of the car if you want ...
You can rotate it in the heading with a null like a ..... wheel ?(
Hope you understand: i'm not sure about my english:shrug:
06-30-2003, 04:51 PM
VBK is right, You could modify this expression to work from the X and Z position of some other object. I currenly just set it up to use the X and Z position of the wheel for the purposes of testing. As for the slowing down problem... hmm.. you may still have that issue when using this expression, but it uses the current distance from the origin to calculate the number of rotations the wheel should have completed.
I just tested it and didn't get any slowing at frame 2000 for the rotation but I'll continue to test
06-30-2003, 05:28 PM
I just tested the expression with a wheel moving at 150 meters per second for 2000 frames and saw no slowdown in the motion. The only major problem I've noticed is if the vehicle turns around completely and heads back along it's initial path then the wheels spin in the wrong direction... maybe I need to do some sort of speed computation to calculate the rotation instead of the X and Z position... hmm.. I'll work on it!
06-30-2003, 05:35 PM
Hey guys...great thread! :)
I've set up a few wheels over the past couple of years from jeeps to shopping trollies mainly using the method oxygen_77 has described. I think the most important thing I've discovered is that this approach is only neccessary when the vehicle is either beginning to move or is moving slowly. Once it's moving fast the rotation will blur out and make it difficult to tell if the rotation is matching the speed, you can simply set a single keyframe for the rotation and set it to accumulate. Just make sure that you set a 'goofy' rotation angle so that you don't get strobing. And yeah...I know what you mean about crossing the z axis...I'm sure that in all probability the wheels on the Gorillaz 19-2000 Geep are rotating backwards in some shots! hehe...:D
06-30-2003, 06:39 PM
Well, I'm stumped... I think I'm going to attempt to write a plugin that can handle rotating some object based on other inputs because I need the ability to hold the last highest distance achieved as well as the ability to recognise the angle of rotation and act on values within a certain range. Here's what I'm thinking though: (in semi psudo code)
HighVal = 0
WheelRotation = 360*( DistanceTraveled() / WheelCircumference )
DistVal = sqrt( (object.Position.X)^2 + (object.Position.Z)^2 )
if(DistVal > HighVal)
then(HighVal = DistVal) // this means the object is moving forwards
if(object.Rotation.H > 90) // this means object has turned around
then(Distance = (HighVal - DistVal) + HighVal)
else(Distance = DistVal)
Well, I think that would do it... I guess I'll start working on it and see..
yeah,plugin or lscript that does this right would be just great :thumbsup:
I remember some time ago some people said they'd had it worked out but I checked and it didnt animate correctly
06-30-2003, 08:40 PM
YEAH would be great a plugin like this.
06-30-2003, 09:35 PM
Relativity does this. Has at least one command for this purpose.
Plus, you get lots more than just wheel spin. ;)
Man, that plug has really gotten lost as of late.
Check it out.
06-30-2003, 11:13 PM
Hmm... relativity could possibly allow someone to set this type of thing up, but it seems like there would still be a lot of work to do in configuring the expression... Hopefully if I can make a lscript plugin to do what I want then it'll only be a matter of selecting the main mover object and the objects to rotate. Plus, I don't feel like spending money on something I could probably make myself. Thanks for the post though uncommongrafx, someone will probably find the Relativity plugin very useful!
07-01-2003, 12:47 AM
If you make the plugin, I'LL find it useful. :bounce:
Tools and weapons is what this venue is all about: the easier it is to wield this LW-Axe, the more I like it.
07-01-2003, 05:10 AM
I recently created a scene for a truck with a driver where all motion was tied to the translation of a single null. You can see an early version of it here:
I ended up using Cyclist for the wheel rotation, as that can calculate distance travelled without worrying about moving across the 0,0,0 line. It also works for moving both forwards and backwards.
01-15-2006, 01:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.