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).
Get/Set the 0-based index of the face to attach to.
Get/Set the barycentric coordinates inside the face to attach to.
Get/Set the time of the key.
Get/Set the selected state of the key.
Get/Set the tension.
Get/Set the continuity.
Get/Set the bias.
Get/Set the EaseTo value.
Get/Set the EaseFrom value.
The following script will create an animated cylinder with a geosphere attached to its top and following all deformations:
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 : PositionController
Key Common Properties, Operators, and Methods
Value Common Properties, Operators, and Methods