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

<strong>Director</strong> can react to multiple keys being pressed simultaneously. The number of simultaneous key presses that can be<br />

detected depends on the keys and on the end-user's operating system. See “Keyboard control” on page 254 for more<br />

details<br />

One solution to this issue is to allow the end-user to customize which keys to use for which actions. See “Customizing<br />

control keys” on page 259 for more details.<br />

Other input devices<br />

You can find links to a number of third-party Xtra extension that allow you to control input from other devices here.<br />

Mouse control<br />

You can let the user control the movement of the camera or an avatar with the mouse in many ways. Here are some<br />

examples:<br />

With a fixed view camera and an avatar, you can make the avatar move towards the current position of the mouse<br />

pointer. To determine which point is currently under the mouse, see “Picking” on page 242 and “Sprite space and<br />

world space” on page 247.<br />

With any type of camera, you can move the character towards the point where the user last clicked. You can see an<br />

example of this in the demo movies for “Moving to a given location” on page 225 and “MiniMap” on page 233.<br />

With a first-person or third-person camera, you can use the horizontal movement of the mouse to indicate the<br />

direction in which the character has to turn, and the vertical movement to indicate the speed of its forward or<br />

backward motion. You can see an example of this in the demo movie for “Steering with the mouse” on page 221.<br />

With a first-person camera, you can use the mouse to control the direction in which the character is looking. You<br />

can see an example of this in the demo movie for “Looking around” on page 222.<br />

If your project allows you to use a third-party Xtra extension, then you can also implement a system where the user turns<br />

the mouse scroll wheel to advance, or moves the mouse continuously in the direction of travel. See the tutorials here.<br />

Picking<br />

A 3D sprite simulates a 3D space on a 2D screen. On a 2D screen, the tip of the mouse pointer covers exactly one pixel.<br />

On top of a 3D sprite, the mouse pointer is like a finger pointing away from your eyes out towards the far end of the<br />

universe. The position of the pointer defines a line, not a point. The technical term for a line that starts at a point and<br />

continues to infinity is a ray.<br />

<strong>Director</strong> provides two functions to let you discover what model or models appear under the mouse pointer: the simple<br />

modelUnderLoc and the more powerful modelsUnderLoc.<br />

Tip: You can also send out a ray from any point within a 3D world in any direction to see what model or models can be<br />

found in that direction. See modelsUnderRay for more details.<br />

To detect rigidBody and terrain objects, you can use these methods provided by the Dynamiks Xtra: rayCastClosest and<br />

rayCastAll.<br />

Last updated 8/26/2011<br />

242

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

Saved successfully!

Ooh no, something went wrong!