Wheel on Spline Tut1
Xpresso – by: base80
January 5th, 2006
How to make a wheel rotate on a spline in 7 steps. (please read the 2nd Tut it is way easier)
This is the formula: 2Pi * (Length of spline / distance on spline) / circumference of wheel(2Pi*r) = rotation(in radians)
Follow up:
Lets get started with a Spline (path) and a Cylinder (wheel)
Put the Cylinder in a Null
Align the Null on the Spline with the align-to-spline tag.
Now add an Xpresso tag somewhere and open the editor.
Drag the Cylinder, the Null, the Spline and the Align-tag in the editor.
1. Determine the length of the spline
Add a spline tag to the xpresso editor, connect its object port to the object port of the spline (object). Open the length port of the spline node and it gives you the lenght.
result nodes are blue
2. Determine the circumference of the wheel, Remember 2? r (2Pi r)
Open the radius port of the cylinder and multiply it by 2Pi (preset of the constant node)
3. Determine the total number of rotation the wheel does on the whole spline.
Divide the length of the spline by the circumference of the wheel (step 1 / step 2)
4. Determine where the wheel is on the spline.
Open the position port of the align to spline node. It will result in a 0.nn–>1 number
5. Determine the number of rotations compared to current position.
Multiply the total numbers of rotations (step 3) by the position on the spline (step 4)
6. Convert the result to radians
Until now we had the number of rotations on the spline. Now we multiply by 2Pi as to get radians. Do not convert to degrees as this is not an internal unit of xpresso.
7. Connect the result to the Cylinder Rotation-P
Voila you are rolling !!