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

Applying a transform to a position<br />

A transform is a frame of reference in mathematical terms. When a transform is applied to a vector position, it moves<br />

that vector position to a new point in space. The lines highlighted in yellow in the Script window and the Message<br />

window show what happens when a neutral transform is applied to the position of vertex 1: it stays the same. The lines<br />

highlighted in orange in the Script window and the Message window show what happens when the modified transform<br />

is applied to the position of vertex 1. In this case, the vertex moves to the new position that is shown by the orange<br />

circle.<br />

For more mathematical information concerning transforms, see “Transforms” on page 370.<br />

Translation<br />

To move a model from one position to another, you can use the node.translate() command. In the simplest terms, the<br />

translate() command tells the model how far to move to the right, how far to move up, and how far to move<br />

forward.<br />

After a translate()command has been executed, the model will still be facing in the same direction. When you think<br />

about a translate() command, the order of the three separate movements is not important. Imagine that you move<br />

a model 3 units to the left, 4 units down and 7 forward. The model would arrive in exactly the same spot as if you started<br />

from the original position and moved it 7 units forward, 3 units left, and then 4 units down.<br />

Rotation<br />

To rotate a model, you can use the rotate() command.<br />

In a 3D world, you can rotate around three different axes: x, y and z. The rotate() command expects a value in<br />

degrees for each axis. For example, this statement will rotate the Jug model 45°around the x-axis, -90° around the yaxis,<br />

and 0° around the z-axis:<br />

member("Dinner Party").model("Jug").rotate(45, -90, 0)<br />

The order in which the rotations are performed is important.<br />

Imagine that you are sitting at a table. You have a cup in front of you, and you are holding a jug of water to the right<br />

of the glass. Imagine that the handle of the jug is to your right. You take hold of the jug and tilt it forward. The water<br />

will pour out of its spout into the cup. Imagine that you keep the jug tilted rotate it around its vertical axis. The water<br />

will continue to pour into the cup, but from the side of the jug. All is well (if a little unconventional).<br />

Now imagine that you performed those rotations in a different order. Imagine that you start by rotating the jug around<br />

its vertical axis. The spout is now pointing away from you, and not at the cup. If you now tilt the jug, the water will spill<br />

on the table. This is probably not good.<br />

Direction of rotation<br />

In the Cube example above, the cube model was rotated through -60° around the y-axis. How do you know if that is a<br />

clockwise or a counter-clockwise rotation?<br />

The second “right-hand rule” helps here. Stick out the thumb of your right hand and curl the fingers. Imagine that your<br />

thumb is pointing in the direction of the axis of rotation. Now turn your hand in the direction that your fingers are<br />

pointing. That is the direction of a positive rotation.<br />

The right-hand rule for rotation<br />

Last updated 8/26/2011<br />

29

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

Saved successfully!

Ooh no, something went wrong!