I want that the wheel of the train rotate in Y axis, accordingly to the movement of the Main object "Master" that drive the train.
The wheel is child of a PointHelper "Point01_Right".
So, the PointHelper should drive the Rotation of the wheel.
The Master object have a PathConstraint to one shape Line.
It moves with keyframes from 0% (at frame 0) to 100% (at frame 800) of this path.
The wheel have a radius (wrong!) circumference of 4,7728 meters
The Path have a lenght of 768,785 meters
768,785 meters / 4,7728 meters = 161.07630 (number of total turns that the wheel should do)
I have do one separate file to try the basic operations in this way:
1) Created one EulerXYZ controller for the Point01 Helper that drive the rotation of the wheel
2) At frame 0 the Euler Rotation Y is = 0 ; at frame 800 (end of the animation) the Euler Y rotation value in degrees is = 57987,468
This value is got by multiply the value in degrees of one complete turn: 360° (degree) by the number of turns that the wheel should do to achieve the end of the Path (161.07630).
But I want link the rotation of the wheel to the movement of the Master object along the Path, in the manner that the wheel automatically rotate.
How can I do to link the Y Rotation of the Poin01 (the wheel) to the Path_Constraint Controller (percent) of the Master object (the train)?
I have tried this:
1) create one FloatScript Controller for the Y Rotation property of the "Point01" Helper
2) create in the Script dialog one variable called "Master" assigned to the Node:(object) "Master"
3a) put this script in the FloatScript dialog of Point01 Helper:
The value 161.07630 (about 161) is the total rotational turns that the wheel should do to achieve the end of the Path.
Is it correct this Script?
I should also use the function degToRad() prior to my Script?
The value (...)*161.07630 is it correct to achieve my purpose, or I should use another formula?
I am not sure...