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 />

Here is an experiment to test this:<br />

1 Type the following command in the Message window, but do not execute it yet.<br />

member("Physics").getRigidBody("Cube").isSleeping = TRUE<br />

2 Launch the FirstWorld.dir movie.<br />

3 Set a very low negative value for gravity or a fairly high value for restitution.<br />

4 Click the Lift Cube button.<br />

5 In the Message window, execute the command you typed earlier.<br />

If you act quickly enough, you will be able to freeze the Cube in mid air.<br />

The sleepThreshold property allows you to tell the Physics simulation when to consider that an object has stopped<br />

moving, and that it must start sleeping. Setting it to a non-zero value will mean that all objects that are affected by<br />

friction, linearDamping or angularDamping will eventually start sleeping.<br />

The Physics Simulation behavior in the FirstWorld.dir movie checks the isSleeping property of the Cube<br />

rigidBody on every frame. When this value becomes TRUE, it checks the Cube Is Sleeping check box. You cannot<br />

interact with this check box button directly.<br />

Be careful about setting the value too high because if the value is high, the objects can freeze in mid movement. The<br />

most efficient value will depend on what length a world unit represents in the real world, and on the value of mass<br />

property for dynamic rigidBody objects.<br />

An exaggerated value of sleepThreshold can make objects go to sleep in unnatural positions<br />

The value of sleepThreshold is zero by default. This means that, by default, no dynamic rigidBody objects ever<br />

sleep.<br />

To test this, create a Lingo Movie Script and paste the following scriptText into it:<br />

Last updated 8/26/2011<br />

305

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

Saved successfully!

Ooh no, something went wrong!