## Kinematics.AddConstraint

### Description

Adds a constraint to the 3d object.

### C# Syntax

    Constraint Kinematics.AddConstraint( Object in_cnsPreset, Object in_cnsning, Boolean in_bComp, Object in_offsetCnsned, Object in_offsetCnsning );

### Scripting Syntax

    oReturn = Kinematics.AddConstraint( Preset, Sources, [Compensation], [TargetOffset], [SourceOffset] );

### Return Value

Constraint

### Parameters

Parameter | Type | Description
--- | --- | ---
Preset | String or preset object (see SIGetPreset) or Expression | Constraint Preset to add to object
Sources | X3DObject, X3DObjectCollection or XSICollection | Object(s) that will act as constrainers
Compensation | Boolean | Compensation mode, True to turn on compensation. Default Value: False
TargetOffset | SIVector3 or Array | Target Attachment Point (Distance, Position constraints).
SourceOffset | SIVector3 or Array | Source Attachment Point (Distance, Position, Surface, Trajectory constraints). Rotation Offset (Orientation constraint), Translation Offset (Direction constraint), Scaling Offset (Scaling constraint)

### Examples

#### VBScript Example

    Dim oRoot, oNull, oSphere
    set oRoot = Application.ActiveProject.ActiveScene.Root
    set oNull = oRoot.AddNull
    set oSphere = oRoot.AddGeometry("Sphere","MeshSurface")
    set oConstaint = oSphere.Kinematics.AddConstraint( "Position", oNull, False, Array(0,45.0,90.0) )

### See Also

SIVector3