07.12.2012 Views

Adobe Director Basics

Adobe Director Basics

Adobe Director Basics

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ADOBE DIRECTOR BASICS<br />

3D: Controlling action<br />

Mass and position properties<br />

rigidBody.mass: a non-negative number. The default value of mass is 0.0, but rigidBody objects with a mass of zero<br />

behave the same way as objects with a mass of 1.0. A rigidBody with a mass of zero will fall under the influence of<br />

gravity, and will have a linearMomentum equal to its linearVelocity.<br />

It is good practice to set the mass of all #dynamic rigidBody objects.<br />

rigidBody.centerOfMass: a position vector, relative to the origin point of the model's geometry. The value by default<br />

is vector(0, 0, 0). This defines the point around which the rigidBody will rotate.<br />

rigidBody.position: a vector giving the current world position of the rigidBody. This will be the same as the<br />

worldPosition of the model associated with the rigidBody.<br />

rigidBody.orientation: a list containing a vector axis direction and a scalar angle. This will be the same as the<br />

transform.axisAngle property of the model associated with the rigidBody.<br />

If you change the mass of a moving rigidBody on the fly, the value of its linearVelocity and angularVelocity<br />

will remain unchanged, but the value of its linearMomentum and angularMomentum properties will be adjusted<br />

automatically.<br />

To test these properties, launch the RigidBody.dir movie. Click the Fire Down zAxis button, to make a ball with a mass<br />

of 1 strike the block. Check the value of linearVelocity and linearMomentum. Click the Reset button, alter the mass<br />

of the block, and then click the Fire Down zAxis button again. Notice how the change affects both the relative<br />

movements of the ball and the block, and how the linearVelocity and linearMomentum are related. Now try<br />

moving the centerOfMass to an off-center position and try again.<br />

Testing how mass and centerOfMass affect how a rigidBody behaves after a collision<br />

Last updated 8/26/2011<br />

313

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!