07.12.2012 Views

Adobe Director Basics

Adobe Director Basics

Adobe Director Basics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ADOBE DIRECTOR BASICS<br />

3D: Controlling action<br />

trace(member("Physics").getSpring("test constraint"))<br />

-- spring("test constraint")<br />

trace(member("Physics").getSpring("linear"))<br />

-- <br />

trace(member("Physics").getConstraint("linear"))<br />

-- constraint("linear")<br />

For similar reasons, the physicsMember.getConstraints() function will only include joints in the output list.<br />

trace(member("Physics").getConstraints())<br />

-- [constraint("linear"), constraint("angular")]<br />

To obtain references to all the springs created within a Physics member, you need to use the<br />

physicsMember.getSprings() function.<br />

trace(member("Physics").getSprings())<br />

-- [spring("spring")]<br />

Deleting a joint or spring<br />

To delete a joint or a spring, you can use the physicsMember.deleteConstraint() method. You can provide either the<br />

name of the object to delete, or a reference to it.<br />

trace(member("Physics").getSprings())<br />

-- [spring("spring")]<br />

trace( member("Physics").deleteConstraint("spring"))<br />

-- 1<br />

trace(member("Physics").getSprings())<br />

-- []<br />

vAngularJoint = member("Physics").getConstraint("angular")<br />

trace(vAngularJoint)<br />

-- constraint("angular")<br />

trace( member("Physics").deleteConstraint(vAngularJoint))<br />

-- 1<br />

trace(vAngularJoint)<br />

-- <br />

Note: If you conserved a reference to the ConstraintDesc that you used to create a joint or a spring, the ConstraintDesc<br />

will now be available for use with another joint or spring.<br />

For only springs, you can use the physicsMember.deleteSpring() method. If you attempt to use this method with an<br />

object that is not a spring, a script error occurs. It will fail silently if you use it with a string that is not the name of a<br />

spring.<br />

Angular joint properties<br />

An angular joint between two objects allows those objects to rotate freely to any angle with respect to each other.<br />

However, the distance that separates the two objects is constrained.<br />

For information on how to create, access, and delete an angular joint, see “Joints and springs” on page 330. To<br />

experiment with the way an angular joint will link two rigid objects together, download the movie AngularJoint.dir.<br />

Last updated 8/26/2011<br />

334

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

Saved successfully!

Ooh no, something went wrong!