Accessibility
 
Home > Products > Director > Support > Intermediate Director 3D Features
Macromedia Director Support Center - Intermediate Director 3D Features
Modifying the vector list

When making changes to a model's vector list, it is a good idea to store a copy of the original vector list in a variable so that you can use it to restore the model to its original state later. Use another copy of the vector list as a working copy that you modify.

The setUpMesh handler contains Lingo for these operations:

pStartVertices = aModel.meshdeform.mesh[1].vertexList
pTempVertices = aModel.meshdeform.mesh[1].vertexList
pStartNormals = aModel.meshdeform.mesh[1].normalList
pTempNormals = aModel.meshdeform.mesh[1].normalList

Notice that this Lingo makes two copies of both the vertex list and the normal list. This is because the deformation that the behavior performs uses both of these parts of the model's geometry.

The behavior contains three different animate handlers, triggered in the enterFrame handler. The handler that is used at any given time is determined by the type of deformation you choose in the parameters dialog box for the Twister behavior.

These handlers do the work of mathematically manipulating the model's vector list and normal list. For example, the animate1 handler contains the following Lingo, which performs a trigonometric manipulation of the vertex list.

-- this is the math for manipulating the stored vertex list 
repeat with i = 1 to pStartVertices.count do
    vertex = pStartVertices[i]
    theta = vertex.z * theta_mult
    radius = pStartVertices[i] - pMeshCenter
    radius.z = 0
    -- trigonometric manipulation to calculate a new vertex position for each vertex
    alpha = 1-cos(theta)
    beta  = sin(theta)
    vee   = radius * alpha
    oh   = vector(0,0,0)
    oh.y = radius.x * beta
    oh.x = -radius.y * beta
    pTempVertices[i] = vertex - vee + oh    
    pTempVertices[i].z = pTempVertices[i].z + (pTempVertices[i].z \
    * -5 * theta_mult)
  end repeat
To Table of Contents Back to Previous document Forward to next document