07.12.2012 Views

Adobe Director Basics

Adobe Director Basics

Adobe Director Basics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ADOBE DIRECTOR BASICS<br />

3D: Controlling action<br />

The character controller API in <strong>Adobe</strong> <strong>Director</strong> provides the following functionalities:<br />

You can control the movement of any character.<br />

You can make your characters interact with rigid bodies.<br />

You can control the interaction between different characters.<br />

You can easily define a character controller by following these steps:<br />

1 First, identify the model for the character controller.<br />

2 Determine the axis to be used for the movement of the controller (upVector). The axis can be:<br />

X-axis, which is vector(1,0,0).<br />

Y-axis, which is vector(0,1,0).<br />

Z-axis, which is vector(0,0,1).<br />

A character controller can be created using the createController method:<br />

controllerRef = createController(controllerName,modelName,controllerType,<br />

upVector,slopelimit)<br />

The controller type can be either #box or #capsule. If #capsule is specified, the bounding sphere of the model<br />

is used as the radius for the controller and the bounding box is used for the capsule height. If #box is specified,<br />

the model’s bounding box is used as the controller’s extents.<br />

The slopelimit, signifies the maximum slope that the character can walk. This is expressed as the cosine of the<br />

desired limit angle. A value of 0 disables this function.<br />

Note: The character controller will automatically be treated as a rigid body by the physics engine.<br />

3 Move the character controller using the move method. When the controller is moved using this method, it also<br />

interacts with the rigid bodies in the world. If a callback has been registered by the controller, then it gets called<br />

during the interaction.<br />

When you need to move the character, specify the displacement vector and the distance:<br />

move(displacement, activegroupsList, minDist, sharpness)<br />

The displacement vector is primarily used to move the controller from the current location. The activegroupList<br />

denotes the list of active collision groups that the controller will interact with while moving. minDist, signifies the<br />

minimum distance the controller must travel. If the distance is lesser than this value, the character doesn’t move.<br />

This is used to stop the recursive motion algorithm when the remaining distance to travel is small.<br />

When the controller is moving on an uneven terrain, to prevent the sudden height changes, the motion can be<br />

smoothened using a feedback filter. The sharpness coefficient, defines the amount of smoothing. A smaller value<br />

promotes better smoothing. (1.0 means no smoothing). Here’s an example:<br />

rigidbody1.collisionsgroup = 1<br />

rigidbody2.collisiongroup = 2<br />

myct.move(vector(1,0,0),[1,2], 0.001,1)<br />

The controller interacts with rigidbody1 and rigidbody2 while moving as they are in the list of active collision<br />

groups. If a callback has been registered for a rigid body-controller interaction, it will be invoked.<br />

Download the movie CharacterController.dir to understand the character controller feature in <strong>Director</strong>.<br />

You can use the arrow keys to move the controller (the green model), Try moving the controller towards the rigid body<br />

(the yellow model). The rigid body will get displaced.<br />

Last updated 8/26/2011<br />

353

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

Saved successfully!

Ooh no, something went wrong!