This reference page is linked to from the following overview topics: Checking Return Values for Type.
#include <xsi_kinematics.h>
The Kinematics object represents the kinematics property of an X3DObject object.
using namespace XSI; Application app; Model root = app.GetActiveSceneRoot(); Model myModel; CRefArray emptyModel; root.AddModel( emptyModel, L"MyModel", myModel ); myModel.GetParameter(L"posx").PutValue( (double)5.0 ); Null myNull; myModel.AddNull( L"", myNull ); myNull.GetParameter(L"posx").PutValue( (double)5.0 ); // get local position MATH::CVector3 v3Pos( myNull.GetParameterValue(L"posx"), myNull.GetParameterValue(L"posy"), myNull.GetParameterValue(L"posz") ); app.LogMessage( L"Local position = " + CValue(v3Pos.GetX()).GetAsText() + L", " + CValue(v3Pos.GetY()).GetAsText() + L", " + CValue(v3Pos.GetZ()).GetAsText() ); // transform local to global position MATH::CVector3 v3GlobalPos = MATH::MapObjectPositionToObjectSpace( myNull.GetKinematics().GetGlobal().GetTransform(), myNull.GetKinematics().GetLocal().GetTransform(), v3Pos ); app.LogMessage( L"Global position = " + CValue(v3GlobalPos.GetX()).GetAsText() + L", " + CValue(v3GlobalPos.GetY()).GetAsText() + L", " + CValue(v3GlobalPos.GetZ()).GetAsText() );
Public Member Functions |
|
Kinematics () | |
~Kinematics () | |
Kinematics (const CRef &in_ref) | |
Kinematics (const Kinematics &in_obj) | |
bool | IsA (siClassID in_ClassID) const |
siClassID | GetClassID () const |
Kinematics & | operator= (const Kinematics &in_obj) |
Kinematics & | operator= (const CRef &in_ref) |
CRefArray | GetConstraints () const |
CStatus | AddConstraint (const CString &in_preset, const CRefArray &in_cnsning, bool in_bComp, const MATH::CVector3 &in_offsetCnsned, const MATH::CVector3 &in_offsetCnsning, Constraint &out_constraint) |
KinematicState | GetLocal () const |
KinematicState | GetGlobal () const |
Kinematics | ( | ) |
Default constructor.
~Kinematics | ( | ) |
Default destructor.
Kinematics | ( | const CRef & | in_ref | ) |
Constructor.
in_ref | constant reference object. |
Kinematics | ( | const Kinematics & | 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] |
Kinematics& operator= | ( | const Kinematics & | 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. |
Kinematics& 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.
CRefArray GetConstraints | ( | ) | const |
Returns an array of Constraint objects that are constraining the parent of this object.
CStatus AddConstraint | ( | const CString & | in_preset, |
const CRefArray & | in_cnsning, | ||
bool | in_bComp, | ||
const MATH::CVector3 & | in_offsetCnsned, | ||
const MATH::CVector3 & | in_offsetCnsning, | ||
Constraint & | out_constraint | ||
) |
Applies a constraint to this object's parent.
in_preset | The type of constraint to add. |
in_cnsning | An array of X3DObject references that will act as constrainers. |
in_bComp | Compensation mode, true to turn compensation on. |
in_offsetCnsned | Optional offset which is applied in translation on the constrained object. The offset is used for Distance and Position constraints. |
in_offsetCnsning | Optional offset applied on the constraining object for Distance, Position, Surface and Trajectory constraints. The offset will be applied in rotation for the Orientation constraint, in translation for the Direction constraint and in scaling for the Scaling constraint. |
out_constraint | New constraint object |
KinematicState GetLocal | ( | ) | const |
Returns a KinematicState object containing the local transformation of the X3DObject object (that is, the transformation relative to the parent).
KinematicState GetGlobal | ( | ) | const |
Returns a KinematicState object containing the global transformation of the X3DObject object (that is, the transformation relative to the parent).