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

Dragging<br />

To drag a model about in 3D space using a 2D mouse, you must limit the movement of the model to one 2D surface<br />

within the world. Here are some examples:<br />

A horizontal plane where all points share the same vertical co-ordinate (parallel to the ground).<br />

The surface of a terrain model.<br />

A vertical plane, representing a wall.<br />

A plane that is perpendicular to the camera's zAxis (parallel to the plane occupied by the sprite viewport).<br />

To map the 2D position of the mouse onto the appropriate plane in the 3D world, use vector and transform<br />

mathematics. For more information on 3D mathematics, see “3D mathematics” on page 361. In this article, you can<br />

find reusable solutions for dragging (but not mathematical explanations on how they work).<br />

Dragging a model on a horizontal plane<br />

To see an example of this download and launch the movie AirHockey.dir.<br />

The air hockey puck will move over a horizontal plane as you drag it around<br />

The Air Hockey behavior creates a white model named “Puck”. The Throw Model in Y Plane script uses<br />

spriteSpaceToWorldSpace() to find a point under the mouse. It then imagines a line between the camera and that<br />

point, and works out where that line crosses the horizontal plane where the Puck model is, and moves it to that point.<br />

Here is a very simple behavior that does the same thing:<br />

Last updated 8/26/2011<br />

250

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

Saved successfully!

Ooh no, something went wrong!