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

Click and drag to rotate a face round the opposite edge<br />

On mouseDown, the Mesh Deform behavior in the movie uses modelsUnderLoc() to detect where you clicked. The<br />

list returned by call contains the following data:<br />

[[#model:model("Deformable octahedron"),<br />

#distance: 109.1726,<br />

#isectPosition: vector( 1.0218, 23.5829, 0.3953 ),<br />

#isectNormal: vector( 0.5774, 0.5774, 0.5774 ),<br />

#meshID: 1,<br />

#faceID: 7,<br />

#vertices: [vector( 0.0000, 25.0000, 0.0000 ),<br />

vector( 0.0000, 0.0000, 25.0000 ),<br />

vector( 25.0000, 0.0000, 0.0000 )],<br />

#uvCoord: [#u: 0.0158, #V: 0.0409]]]<br />

The information shown in bold above is used to work out which is the nearest vertex. The handlers executed during<br />

the #mouseDown event access the data stored in the meshDeform object. They use this to create a property list<br />

containing all the information required to rotate the vertex point around the opposite edge of its face.<br />

Updating normals<br />

It is not enough just to update the position of the vertex point. If the normals of each vertex are not updated, then the<br />

face continues to react to light as if it were in its original orientation. In the Mesh Deform behavior, after moving the<br />

vertex point, the mMoveVertex() handler calls mUpdateNormals(). This sets the normal of the dragged vertex at right<br />

angles to the face, and sets the normals of the two other vertices of that face to the average of the normal to that face<br />

and its neighbor.<br />

Note: Wherever vertices are shared between faces, the normals at those vertex points are also shared. If you use the<br />

#meshDeform modifieron models that are custom-built for the project, you may need to make sure that the model is<br />

specifically constructed to allow the deformations that you want to apply.<br />

Multiple texture layers<br />

With the #meshDeform modifier, you can add extra texture layers to specific faces. See add (3D texture) and<br />

textureLayer.<br />

Last updated 8/26/2011<br />

192

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

Saved successfully!

Ooh no, something went wrong!