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

-- Create a group to act as the parent of the cube<br />

vGroup = p3DMember.newGroup("Cube Base")<br />

vGroup.addChild(vCube, #preserveWorld)<br />

By default, the new group will be created at the center of the world, at vector(0, 0, 0). This vector now corresponds<br />

to the center of the base of the Cube. Instead of moving and scaling the Cube, you can now move and scale the<br />

group(“Cube Base”). This requires a small change in the code of the Group as Parent behavior.<br />

Find these lines:<br />

--===========================================================--<br />

-- MAKE CHANGES HERE --<br />

-- Prepare to move the cube... or the group<br />

pMovableNode = vCube<br />

--pMovableNode = vGroup -- REMOVE THE FIRST TWO -- CHARACTERS<br />

--===========================================================--<br />

Change these lines to:<br />

--===========================================================--<br />

-- MAKE CHANGES HERE --<br />

-- Prepare to move the cube... or the group<br />

--pMovableNode = vCube<br />

pMovableNode = vGroup -- REMOVE THE FIRST TWO -- CHARACTERS<br />

--===========================================================--<br />

Now restart the movie and watch the cube as its scale changes. Click on the plane model, and drag the mouse pointer<br />

around.<br />

If you move and scale the Cube Base group, the Cube will remain sitting on the plane<br />

This technique consists of three steps:<br />

1 Creating a group.<br />

2 Placing the group at the position that you want to use as the new origin point for the model.<br />

3 Making the model a child of the group.<br />

In this movie, step 2 was achieved by moving the model rather than by moving the group. See addChild() for more<br />

information on the options for step 3.<br />

Note: For more information on detecting the model under the mouse pointer, see “User interaction” on page 240.<br />

Last updated 8/26/2011<br />

32

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

Saved successfully!

Ooh no, something went wrong!