DigitalSpaces::DIPhysicsJoint Struct Reference
[Physics]

#include <Physics_Joint.h>

Inherits DigitalSpaces::DIObjectBase.


Detailed Description

Interface for interacting with a physics simulated joint.

Physics joints are used to link together two bodies, and limit the ways in which the bodies can move in relation to each other. The joint types (as specified to DIPhysicsBase::BeginSetup(const char*) ) are:

See also http://www.digitalspaces.net/wiki/index.php/Scene_File_Format#joint .

Not all the functions included in this interface are appropriate for all joint types. When not appropriate, the function should just be silently ignored.

The joint types and the values that are accepted through the Set functions (name, type, default value):


Public Member Functions

void SetAngularLimits (float fLow, float fHigh, unsigned char cAxis)
 Limit the degree of motion around the specified axis of the joint.
void SetLinearLimits (float fLow, float fHigh, unsigned char cAxis)
 Limit the range of motion along the specified axis of the joint.
float GetAngularLowLimit (unsigned char axis)
 Retreive the lower angular limit.
float GetAngularHighLimit (unsigned char axis)
 Retreive the higher angular limit.
float GetLinearLowLimit (unsigned char axis)
 Retreive the lower linear limit.
float GetLinearHighLimit (unsigned char axis)
 Retreive the higher linear limit.
float GetAngle (unsigned char cAxis)
 Return the joints rotation, around the specified axis.
float GetPosition (unsigned char cAxis)
 Returns the joints position, along the spcified axis.
float GetAngularVelocity (unsigned char cAxis)
 Returns the joints rotational velocity (change in orientation) around the specified axis.
float GetLinearVelocity (unsigned char cAxis)
 Returns the joints linear velocity (change in position) along the specified axis.
void SetMotorParameters (float fVelocity, float fForce, unsigned int motor)
 Set the target speed and maximum force to be used by the physics simulation, to simulate a motorized joint.
float GetMotorVelocity (unsigned int motor)
 Return the motor velocity setting, as set via SetMotorParameters.
float GetMotorForce (unsigned int motor)
 Return the motor force setting, as set via SetMotorParameters.
void ApplyForce (float fForce, unsigned char cAxis)
 Apply a linear force along the specified axis of the joint.
void ApplyTorque (float fTorque, unsigned char cAxis)
 Apply a rotational force around the specified axis of the joint.
DIPhysicsBodyGetBody ()
 Returns one of the bodies this joint is attached to.
DIPhysicsBodyGetOtherBody ()
 Returns the other body this joint is attached to.

Member Function Documentation

void DigitalSpaces::DIPhysicsJoint::SetAngularLimits ( float  fLow,
float  fHigh,
unsigned char  cAxis 
)

Limit the degree of motion around the specified axis of the joint.

Note:
fLow must be less then fHigh, otherwise no limit is applied at all. This can be used to remove a limit, if desired.

Setting fLow equal to fHigh will result in a limit being placed, however it is often not stable.

Applicable joint types:
  • hinge
  • hinge2 - While a multi acis joint, implementation does not allow limitation around second axis
Parameters:
fLow The lower limit, between pi and -pi, measured in radians from the joints default position.
fHigh The upper limit, between pi and -pi, measured in radians from the joints default position.
cAxis Zero based index of which axis to limit, used for multi-axis joints.

void DigitalSpaces::DIPhysicsJoint::SetLinearLimits ( float  fLow,
float  fHigh,
unsigned char  cAxis 
)

Limit the range of motion along the specified axis of the joint.

Note:
fLow must be less then fHigh, otherwise no limit is applied at all. This can be used to remove a limit, if desired.

Setting fLow equal to fHigh will result in a limit being placed, however it is often not stable.

Applicable joint types:
  • slider
Parameters:
fLow The lower limit, measured in meters from the joints default position.
fHigh The upper limit, measured in meters from the joints default position.
cAxis Zero based index of which axis to limit, used for multi-axis joints.

float DigitalSpaces::DIPhysicsJoint::GetAngularLowLimit ( unsigned char  axis  ) 

Retreive the lower angular limit.

Returns:
Low limit, or 0 if not appropriate.
Applicable joint types:
  • hinge
  • hinge2 - While a multi acis joint, implementation does not allow limitation around second axis
Parameters:
axis Zero based index of which axis to limit, used for multi-axis joints.
Note:
The default value by the implementation docs is -infinity, not sure how this will extract as. Should return this as "not appropriate" error condition as well.

float DigitalSpaces::DIPhysicsJoint::GetAngularHighLimit ( unsigned char  axis  ) 

Retreive the higher angular limit.

Returns:
High limit, or 0 if not appropriate.
Applicable joint types:
  • hinge
  • hinge2 - While a multi acis joint, implementation does not allow limitation around second axis
Parameters:
axis Zero based index of which axis to limit, used for multi-axis joints.
Note:
The default value by the implementation docs is infinity, not sure how this will extract as. Should return this as "not appropriate" error condition as well.

float DigitalSpaces::DIPhysicsJoint::GetLinearLowLimit ( unsigned char  axis  ) 

Retreive the lower linear limit.

Returns:
Low limit, or 0 if not appropriate.
Applicable joint types:
  • slider
Parameters:
axis Zero based index of which axis to limit, used for multi-axis joints.
Note:
The default value by the implementation docs is -infinity, not sure how this will extract as. Should return this as "not appropriate" error condition as well.

float DigitalSpaces::DIPhysicsJoint::GetLinearHighLimit ( unsigned char  axis  ) 

Retreive the higher linear limit.

Returns:
High limit, or 0 if not appropriate.
Applicable joint types:
  • slider
Parameters:
axis Zero based index of which axis to limit, used for multi-axis joints.
Note:
The default value by the implementation docs is -infinity, not sure how this will extract as. Should return this as "not appropriate" error condition as well.

float DigitalSpaces::DIPhysicsJoint::GetAngle ( unsigned char  cAxis  ) 

Return the joints rotation, around the specified axis.

Returns:
Angle measured in radians, between -pi and pi, or 0 if not applicable
Applicable joint types:
  • hinge
  • hinge2 - Implementation returns angle around 0th axis, regardless of value of cAxis?
Parameters:
cAxis Zero based index of which axis to limit, used for multi-axis joints.

float DigitalSpaces::DIPhysicsJoint::GetPosition ( unsigned char  cAxis  ) 

Returns the joints position, along the spcified axis.

Returns:
Distance measured in meters, or 0 if not applicable.
Applicable joint types:
  • slider
Parameters:
cAxis Zero based index of which axis to limit, used for multi-axis joints.

float DigitalSpaces::DIPhysicsJoint::GetAngularVelocity ( unsigned char  cAxis  ) 

Returns the joints rotational velocity (change in orientation) around the specified axis.

Returns:
Change in angle, measured in radians per second, or 0 if not applicable.
Applicable joint types:
  • hinge
  • hinge2
Parameters:
cAxis Zero based index of which axis to return value for.

float DigitalSpaces::DIPhysicsJoint::GetLinearVelocity ( unsigned char  cAxis  ) 

Returns the joints linear velocity (change in position) along the specified axis.

Returns:
Speed measured in meters per second, or 0 if not applicable.
Applicable joint types:
  • Slider
Parameters:
cAxis Zero based index of which axis to return value for.

void DigitalSpaces::DIPhysicsJoint::SetMotorParameters ( float  fVelocity,
float  fForce,
unsigned int  motor 
)

Set the target speed and maximum force to be used by the physics simulation, to simulate a motorized joint.

Parameters:
fVelocity Target velocity of the joint. Depending on the joint type, this is measured in radians per second (hinge, hinge2) or meters per second (slider).
fForce Maximum for usable by the simulation to accelerate the joint to the specified velocity, and to keep it there. Setting this to zero disables the motor.
motor Specifies which axis of a multi axis joint should be motorized. This is only applicable for hinge2, where 0 motorizes the "wheel" joint, and 1 motorizes the "steering" joint.
Applicable joint types:
  • hinge
  • hinge2
  • Slider

float DigitalSpaces::DIPhysicsJoint::GetMotorVelocity ( unsigned int  motor  ) 

Return the motor velocity setting, as set via SetMotorParameters.

Parameters:
motor Specifies which axis of a multi axis joint to return the value for.
Returns:
0 If not applicable.
Applicable joint types:
  • hinge
  • hinge2
  • Slider

float DigitalSpaces::DIPhysicsJoint::GetMotorForce ( unsigned int  motor  ) 

Return the motor force setting, as set via SetMotorParameters.

Parameters:
motor Specifies which axis of a multi axis joint to return the value for.
Returns:
0 If not applicable.
Applicable joint types:
  • hinge
  • hinge2
  • Slider

void DigitalSpaces::DIPhysicsJoint::ApplyForce ( float  fForce,
unsigned char  cAxis 
)

Apply a linear force along the specified axis of the joint.

This will effectively apply the force to each of the jointed bodies, in opposite directions.

Parameters:
fForce Force to apply, measured in newtons (I think).
cAxis Zero based index of which axis to apply the force along.
Applicable joint types:
  • slider

void DigitalSpaces::DIPhysicsJoint::ApplyTorque ( float  fTorque,
unsigned char  cAxis 
)

Apply a rotational force around the specified axis of the joint.

This will effectively apply the torque to each of the jointed bodies, in opposite directions.

Parameters:
fTorque Torque to apply, measured in newtonmeters (I think).
cAxis Zero based index of which axis to apply the torque around.
Applicable joint types:
  • hinge
  • hinge2

DIPhysicsBody* DigitalSpaces::DIPhysicsJoint::GetBody (  ) 

Returns one of the bodies this joint is attached to.

Returns:
Interface to a body, or NULL if the joint is not attached to any bodies.

DIPhysicsBody* DigitalSpaces::DIPhysicsJoint::GetOtherBody (  ) 

Returns the other body this joint is attached to.

Returns:
Interface to a body, or NULL if the joint is attached to one or no bodies.


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

Generated on Sun Aug 31 17:46:29 2008 for Digital Spaces by  doxygen 1.5.6