## Constraint

Object Hierarchy | Related C++ Class: Constraint

### Inheritance

###

SIObject

ProjectItem

Property

Constraint

### Introduced

v1.0

### Description

The Constraint object represents a constraint in the scene graph. Constraints allow you to constrain objects to other object's animation. For example, you can constrain an object to always point in the direction of another object using the direction constraint. You apply constraints on objects using the Kinematics.AddConstraint method. You can find the constraints that are being applied to an object using the Kinematics.Constraints property or find which constraint is driving a particular parameter using the Parameter.Source property. You can get the Constraint's type with SIObject.Type property.

### Methods

AddCustomOp | AddICEAttribute | AddScriptedOp | AddScriptedOpFromFile
AnimatedParameters2 | BelongsTo | EvaluateAt | GetICEAttributeFromName
IsA | IsAnimated2 | IsClassOf | IsEqualTo
IsKindOf | IsLocked | IsSelected | LockOwners
RemoveICEAttribute | SetAsSelected | SetCapabilityFlag | SetLock
TaggedParameters | UnSetLock |  |

### Properties

Application | Branch | BranchFlag | Capabilities
Categories | Constrained | Constraining | EvaluationID
Families | FullName | Help | HierarchicalEvaluationID
ICEAttributes | LockLevel | LockMasters | LockType
Model | Name | NestedObjects | ObjectID
Origin | OriginPath | Owners | PPGLayout
Parameters | Parent | Parent3DObject | Selected
Singleton | Type | UpVectorReference |

### Examples

#### VBScript Example

    '

    ' This example illustrates how to apply a direction constraint to a sphere so that it always

    ' points in the direction of the null. We then enumerate all the constraints on the sphere

    ' using the kinematics.contraints property.

    '

    Dim oRoot, oNull, oSphere

    set oRoot = Application.ActiveProject.ActiveScene.Root

    set oNull = oRoot.AddNull

    set oSphere = oRoot.AddGeometry("Sphere","MeshSurface")

    oSphere.Kinematics.AddConstraint "Direction", oNull

    set oConstraints = oSphere.Kinematics.Constraints

    for each oCns in oConstraints

    	LogMessage oCns.FullName

    next

### See Also

ConstraintCollection Kinematics Kinematics.AddConstraint Parameter.Source ApplyCns