
Create a polygon cylinder (radius = 1.0; height = 0.3; subDivs around axis = 20; subdivs on caps = 0; axis = z;), rename it to "wheelFL" - this will be our front-left wheel. Delete its history.
Scale the wheel by 2.0 in x-direction. Create a locator "locFL", make it a child of the wheel. This will be the contact point with the main body later on.
Note: Of course you are free to use a nurbsCylinder, too.
![]() | Dublicate the wheel 3 times. Rename the new wheels to "wheelFR", "wheelBL", "wheelBR". Update the child locators accordingly, too. |
RIGGING
Now that we have build ourselfs a nice little vehicle, let's add some funcionality.
![]() | First, parent all vehicle parts to the "vehicle" locator. We will use this locator to move the vehicle later on. |
![]() | We will now turn the "vehicle" locator into the interface to the expressions, driving the animation of our vehicle. Add custom attributes as shown on the left to the "vehicle" node. |
Now we'lll add slightly modified version of the roll ellipse script to each of the wheels.
Add this expression to each of the respective wheel expression interface attributes, don't forget to change the name of the wheel accordingly (you can quickly do this by using a "search and replace" on "FL" in your favourite text editor). I won't go much into details here, take a look at the first tutorial for more information.
// helper connection to the interface attribute // radii of the elliptical wheel // compute perimeter of elliptical wheel // apply the results to our wheel |
Test if all the wheels are rolling correctly by moving the vehicle locator in x-direction. Change the rotational offset values to test if they work correctly, too. Make sure everything runs fine.
OK? Good, on to the movement of the body. The pupose of our expression is to move the main body so it tries to stay in contact with the contact locators on the wheels. Our first concern is to adjust the position of the main body, we will move this to the mean position of all contact locators. Of course, we've got to use their world position for this as they are not on the same hirachy level as our "body"!
// helper connection to the interface attribute // get positions of contact points of every wheel $pos = `xform -q -ws -t locFL`; $pos = `xform -q -ws -t locFR`; $pos = `xform -q -ws -t locBL`; $pos = `xform -q -ws -t locBR`; // compute mean position |
Our next step is to get the rotation in x- and z-direction for our body. We'll measure the angles between the relative axis and the vector between the respective wheels, to obtain the angle by which we have got to rotate the vehicle's body.
// [..] // get x-angle between the left and right contact position and float $angleXB = `angle <<0.0,0.0,1.0>> ( $posBL - $posBR )`; float $angleX = ($angleXB+$angleXF)/2.0; // get z-angle between the front and back contact position and float $angleZL = `angle <<1.0,0.0,0.0>> ( $posFL - $posBL )`; float $angleZR = `angle <<1.0,0.0,0.0>> ( $posFR - $posBR )`; float $angleZ = ($angleZL+$angleZR)/2.0; // [..] |
Finally, we have got to apply the results to the "body":
// [..] // apply results to body, take into account that "body" is body.rotateX = rad_to_deg($angleX); |
![]() | Here you are! |
EXAMPLE MOVIE
Watch an example movie with the vehicle in action > wackyVehicle.avi (xxx mb) (todo)
DOWNLOAD
example scene and expressions > rollEllipse1_1.zip
discuss this topic to forum




