PDA

View Full Version : How to make one FloatScript for YRotation Wheel, linked to a X AxisMovement?

 Horsepower12-21-2007, 06:17 PMI have made this Train scene file with 3dsMax9 (.zip): http://forums.cgsociety.org/attachment.php?attachmentid=121714&stc=1 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). 360*161.07630=57987,468 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: (Master.position.Path_Constraint.controller.percent)*161.07630 3b) explanation: 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... Please help!
RobertMayer
12-21-2007, 07:53 PM

Number of Rotations = Path Length / CIRCUMFRANCE of Wheel (that of course, being 2πR)

I don't know if that helps, but I can't really experiment with your system, since I'm at work.

Horsepower
12-21-2007, 10:01 PM
Yes!
Excuse me: the value 4,7728 meters is the circumference, not the radius.

Therefore:
Radius of the wheel is: 0,76 meters
Circumference is: 4,7728 meters (0,76+0,76*3,14)
Path is: 768,785 meters

The math is:
768,785 / 4,7728 = 161.07630 number of rotations

But I don't know how apply it in my Script and if it is correct...

Horsepower
12-22-2007, 12:40 PM
I have tried to verify my last Script by creating one ExposeTransform Helper, but the problem is that this helper expose the LocalEulerAngles by breaking the Y value after 180 degrees of rotation in the X and Z values; this is a feature of EulerAngles.

I need instead, a total count of degrees that the wheel do at the end of the animation in Y axis(frame 800).
This because I want to compare the total rotational degrees of the wheel at the end of the animation made by FloatScript, with the total rotational degrees of the wheel in the animation made by a simple EulerXYZ controller.
This value should be= 57987,468 degrees in Y axis.

I am not expert with MaxScript...

CGTalk Moderation
12-22-2007, 12:40 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.