When we write this dependency down to a formula it looks like this:
travelled_distance = (rotation_in_degree * ( wheel_diameter * pi )) / 360;
When we modify the formula so that we get the rotation as a result it looks like this:
rotation_in_degrees = (travelled_distance / ( wheel_diameter * pi )) * 360;
In our example the wheel travels along the X axis and rotates around the Z axis. The diameter is 0.6 units. (You will hardly find a wheel with a diameter of exactly 0.6 in the real world. To get the diameter of your current wheel model look in the group info window in the Info tab under Y Size. Use this value as wheel_diameter variable in your statement).
We end up with an expression that looks like this:
double wheel_diameter = 0.6;
double travelled_distance = wheel.Position.Z;
double rotation_in_degrees = ( travelled_distance / ( wheel_diameter * pi )) * 360;
wheel.Pitch_X = rotation_in_degrees;
Or, if we don't use variables but insert the channels directly into the statement:
wheel.Pitch_X = ( wheel.Position.Z / ( 0.6 * pi )) * 360;
|