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