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

For more information on path-finding techniques to use in your projects, look up the A* algorithm by clicking the<br />

following links:<br />

Google search<br />

Wikipedia<br />

Lingo implementation<br />

Third-person camera<br />

In a 3D scene where the camera follows a user-controlled avatar, two levels of collision detection are required. Neither<br />

the avatar nor the camera must pass through any solid objects. If the camera moves through a wall, or even moves too<br />

close to it, the surface of the wall will appear to tear. The illusion of solidity will be lost.<br />

To animate a third-person camera that follows an avatar, you will need to:<br />

Control the movement of the avatar in 3D space.<br />

Control the movement of the camera relative to the avatar.<br />

In “Not walking through objects” on page 222, you learn how to simulate a cylindrical space around a 3D node, to<br />

prevent the node itself from colliding with walls. This concept is used here to create a zone around the avatar. If the<br />

camera is on the surface of the same cylinder then it will not pass through any walls either.<br />

In “Steering with the keyboard” on page 224, you learn how to move a node around a 3D space. In this article, the same<br />

technique is used to move an object representing the user's avatar. The movement of the camera is treated as a second step.<br />

The concept<br />

A third-person camera normally follows an avatar from behind. If the avatar always moves straight forwards, the<br />

camera can simply move forward with the avatar. You can safely assume that the space between the avatar and the<br />

camera is clear of obstacles. The situation is not so simple if the avatar turns.<br />

Imagine that the user steers the avatar into a corner. The avatar cannot move any further forward. To move elsewhere,<br />

the user first has to turn the avatar around to face away from the corner. To get behind the avatar if it turns, the camera<br />

must move into the space between the avatar and wall.<br />

Imagine that the avatar is now standing with its back against the corner. There is no space between the imaginary<br />

cylinder that surround the avatar and the wall. As a result, the camera will have to move in towards the avatar until it<br />

is on the surface of the imaginary cylinder.<br />

The distance that the camera lags behind the avatar depends on the relative position of walls<br />

Last updated 8/26/2011<br />

230

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

Saved successfully!

Ooh no, something went wrong!