Attachment Controller Keys

Attachment controllers use different keys than most other controllers. The MAXAKey class implements the keys of Attachment controllers with all their specific properties like face index and barycentric coordinates inside the face.

The AttachCtrl.getKey() method returns keys of class MAXAKey. The method expects two arguments - the attachment controller and the index of the key to get. (See Attachment : PositionController for a list of all available AttachCtrl methods).

Properties

<MAXAKey>.face : Integer (0-based)

Get/Set the 0-based index of the face to attach to.

<MAXAKey>.coord : Point2 (barycentric coordinates)

Get/Set the barycentric coordinates inside the face to attach to.

<MAXAKey>.time : Time

Get/Set the time of the key.

<MAXAKey>.selected : Boolean

Get/Set the selected state of the key.

<MAXAKey>.tension : Float

Get/Set the tension.

<MAXAKey>.continuity : Float

Get/Set the continuity.

<MAXAKey>.bias : Float

Get/Set the bias.

<MAXAKey>.easeTo : Float

Get/Set the EaseTo value.

<MAXAKey>.easeFrom : Float

Get/Set the EaseFrom value.

The following script will create an animated cylinder with a geosphere attached to its top and following all deformations:

example:

c = cylinder height:100 heightsegs:10 --create a tall segmented cylinder

addModifier c (Bend()) --add a Bend Modifier to the cylinder

s = geosphere() --create a default geosphere

actrl = Attachment() --create an Attachment controller

s.position.controller = actrl --assign to the position of the geosphere

actrl.node = c --set the cylinder as the node to attach to

addNewKey actrl 0f --add a key at frame 0

 

theAKey = AttachCtrl.getKey actrl 1 --get the first key

 

--Set the face index (0-based) by reading the number of faces in the mesh

--The last face of a cylinder is always on top near the central vertex!

theAKey.face = c.mesh.numfaces - 1

 

--Set the coordinates for the center.

--The barycentric coordinates of the central vertex are [1,0]

theAKey.coord = [1,0]

 

with animate on at time 100 --animate on frame 100

(

c.height = 200 --animate the height of the cylinder

c.bend.angle = 90 --and the bend angle

)

 

Attachment_Controller_Example_Frame_0.gif Attachment_Controller_Example_Frame_100.gif

See also

Attachment : PositionController

Key Common Properties, Operators, and Methods

Value Common Properties, Operators, and Methods