Public Member Functions
Constraint Class Reference

## Detailed 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 Kinematics::AddConstraint. You can find the constraints that are being applied to an object using Kinematics::GetConstraints() or find which constraint is driving a particular parameter using Parameter::GetSource. You can get the Constraint's type with SIObject::GetType property.

See also:
  Kinematics

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.

            using namespace XSI;
            Application app;
            Model root = app.GetActiveSceneRoot();

            Null myNull;
            root.AddNull( L"", myNull );

            X3DObject mySphere;
            root.AddGeometry( L"Sphere", L"MeshSurface", L"", mySphere );

            Kinematics kine(mySphere.GetKinematics());

            CRefArray constrainings(1);
            constrainings[0] = myNull;

            Constraint dirCns;
            kine.AddConstraint( L"Direction", constrainings, false, MATH::CVector3(),
                MATH::CVector3(), dirCns );

            CRefArray constraints( kine.GetConstraints() );

            for ( LONG i=0; i<(LONG)constraints.GetCount(); i++ )
            {
                SIObject siobj( constraints[i] );
                app.LogMessage( siobj.GetName() );
            }

`#include <xsi_constraint.h>`

Inheritance diagram for Constraint:
[legend]

List of all members.

## Public Member Functions
| Constraint ()
| ~Constraint ()
| Constraint (const CRef &in_ref)
| Constraint (const Constraint &in_obj)
bool | IsA (siClassID in_ClassID) const
siClassID | GetClassID () const
Constraint & | operator= (const Constraint &in_obj)
Constraint & | operator= (const CRef &in_ref)
X3DObject | GetConstrained () const
CRefArray | GetConstraining () const
X3DObject | GetUpVectorReference () const
CStatus | PutUpVectorReference (const X3DObject &in_obj)

## Constructor & Destructor Documentation

Constraint | ( |  | ) |

Default constructor.

~Constraint | ( |  | ) |

Default destructor.

Constraint | ( | const CRef & | in_ref | ) |

Constructor.

Parameters:

  in_ref | constant reference object.

Constraint | ( | const Constraint & | in_obj | ) |

Copy constructor.

Parameters:

  in_obj | constant class object.

## Member Function Documentation

bool IsA | ( | siClassID | in_ClassID | ) | const `[virtual]`

Returns true if a given class type is compatible with this API class.

Parameters:

  in_ClassID | class type.

Returns:
  true if the class is compatible, false otherwise.

Reimplemented from Property.

siClassID GetClassID | ( |  | ) | const `[virtual]`

Returns the type of the API class.

Returns:
  The class type.

Reimplemented from Property.

Constraint& operator= | ( | const Constraint & | in_obj | ) |

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:

  in_obj | constant class object.

Returns:
  The new Constraint object.

Constraint& operator= | ( | const CRef & | in_ref | ) |

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:

  in_ref | constant class object.

Returns:
  The new Constraint object.

Reimplemented from Property.

X3DObject GetConstrained | ( |  | ) | const

Returns the object being constrained by the constraining objects.

Returns:
  The constrained object.

CRefArray GetConstraining | ( |  | ) | const

Returns an array of constraining objects that are used to constrain an object.

Returns:
  Array of references to the constraining X3DObject objects.

X3DObject GetUpVectorReference | ( |  | ) | const

Returns the object acting as the UpVector reference.

Returns:
  UpVector reference object.

CStatus PutUpVectorReference | ( | const X3DObject & | in_obj | ) |

Sets the object acting as the UpVector reference. The UpVector reference can be removed by passing in an empty reference.

Parameters:

  in_obj | The UpVector reference object.

Returns:
  CStatus::OK success
  CStatus::Fail failure

The documentation for this class was generated from the following file:

- xsi_constraint.h