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

Using interpolateTo() gives a natural lag between the movement of the avatar and the movement of the camera<br />

In the ElasticCamera.dir movie, take a look at the Elastic Third Person Camera script. The on stepFrame() handler<br />

includes a command similar to the following.<br />

sprite(1).camera.transform.interpolateTo(aRestTransform, 10.0)<br />

Launch the movie and the following commands in the Message window. You will observe that the avatar moves<br />

backwards and to the left, moving halfway towards the position vector(-125, 0, 250) and rotating halfway towards<br />

the rotation vector(0, -45, 0). The camera will move smoothly after this point, using interpolateTo() several times<br />

on successive frames, until it comes to rest giving the view shown in the screenshot above.<br />

-- Lingo<br />

vAvatarTransform = member("3D").group("Avatar_Parent").transform<br />

vTargetTransform = transform()<br />

vTargetTransform. position = vector(-125, 0, 250)<br />

vTargetTransform. rotation = vector(0, -45, 0)<br />

vAvatarTransform.interpolateTo(vTargetTransform, 50.0)<br />

// Javascript<br />

vAvatarTransform = member("3D").getPropRef("group", 2).transform<br />

vTargetTransform = transform();<br />

vTargetTransform. position = vector(-125, 0, 250);<br />

vTargetTransform. rotation = vector(0, -45, 0);<br />

vAvatarTransform.interpolateTo(vTargetTransform, 50.0);<br />

Following a path<br />

You don't always want to move a node along a straight path. This article explains one way to move a node along a<br />

curved path. You can find an alternative solution at “Keyframe animations” on page 274.<br />

To visualize the technique described here, download and launch the movie Tubing.dir.<br />

Last updated 8/26/2011<br />

267

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

Saved successfully!

Ooh no, something went wrong!