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.
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>
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) |
Constraint | ( | ) |
Default constructor.
~Constraint | ( | ) |
Default destructor.
Constraint | ( | const CRef & | in_ref | ) |
Constructor.
in_ref | constant reference object. |
Constraint | ( | const Constraint & | in_obj | ) |
Copy constructor.
in_obj | constant class object. |
bool IsA | ( | siClassID | in_ClassID | ) | const [virtual] |
Returns true if a given class type is compatible with this API class.
in_ClassID | class type. |
Reimplemented from Property.
siClassID GetClassID | ( | ) | const [virtual] |
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.
in_obj | constant class 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.
in_ref | constant class object. |
Reimplemented from Property.
X3DObject GetConstrained | ( | ) | const |
Returns the object being constrained by the constraining objects.
CRefArray GetConstraining | ( | ) | const |
Returns an array of constraining objects that are used to constrain an object.
X3DObject GetUpVectorReference | ( | ) | const |
Returns the object acting as the UpVector reference.
Sets the object acting as the UpVector reference. The UpVector reference can be removed by passing in an empty reference.
in_obj | The UpVector reference object. |