Project

General

Profile

SO3Engine

hinge joint. More...

#include <OgreNewt_BasicJoints.h>

Inheritance diagram for OgreNewt::Hinge:
OgreNewt::Joint

Public Member Functions

 Hinge (const OgreNewt::Body *child, const OgreNewt::Body *parent, const Ogre::Vector3 &pos, const Ogre::Vector3 &pin)
 constructor
 
 ~Hinge ()
 destructor
 
void enableLimits (bool state)
 enable hinge limits.
 
void enableMotor (bool state)
 
void setLimits (Ogre::Radian minAngle, Ogre::Radian maxAngle)
 set minimum and maximum hinge limits.
 
Ogre::Radian getJointAngle () const
 get the relative joint angle around the hinge pin.
 
Ogre::Vector3 getJointForce ()
 retrieve the current joint force.
 
Ogre::Radian getJointAngularVelocity () const
 get the relative joint angle around the hinge pin.
 
Ogre::Vector3 getJointPin () const
 get the joint pin in global space
 
void setDesiredOmega (Ogre::Radian omega, Ogre::Real strength=0.5f)
 sets desired rotational velocity of the joint
 
void setDesiredAngle (Ogre::Radian angle, Ogre::Real minFriction=0, Ogre::Real maxFriction=0)
 set desired angle and optionally minimum and maximum friction
 
void setTorque (Ogre::Real torque)
 sets hinge torque
 
void setBrake (Ogre::Real maxForce=0)
 apply hinge brake for one frame.
 
void clearConstraints ()
 clears the motor constraints
 
virtual void submitConstraint (Ogre::Real timestep, int threadindex)
 must be define for a functioning joint.
 
- Public Member Functions inherited from OgreNewt::Joint
 Joint ()
 constructor
 
virtual ~Joint ()
 destructor
 
BodygetBody0 () const
 get the pointer to the first rigid body
 
BodygetBody1 () const
 get the pointer to the first rigid body
 
const OgreNewt::WorldgetWorld ()
 get the pointer to the world
 
virtual void showDebugData (Ogre::SceneNode *debugRootNode)
 show joint visual debugging data
 
int getCollisionState () const
 returns collision state
 
void setCollisionState (int state) const
 sets the collision state
 
Ogre::Real getStiffness () const
 get joint stiffness
 
void setStiffness (Ogre::Real stiffness) const
 set joint stiffness
 

Protected Types

enum  ConstraintType { CONSTRAINT_NONE , CONSTRAINT_OMEGA , CONSTRAINT_ANGLE , CONSTRAINT_BRAKE }
 

Protected Attributes

ConstraintType m_constraintType
 
ConstraintType m_lastConstraintType
 
Ogre::Radian m_desiredOmega
 
Ogre::Radian m_desiredAngle
 
bool m_useLimits
 
bool m_useMotor
 
Ogre::Radian m_minAngle
 
Ogre::Radian m_maxAngle
 
Ogre::Real m_motorStrength
 
Ogre::Real m_motorTorque
 
Ogre::Real m_motorMinFriction
 
Ogre::Real m_motorMaxFriction
 
Ogre::Real m_brakeMaxForce
 
bool m_torqueOn
 
- Protected Attributes inherited from OgreNewt::Joint
CustomJoint * m_joint
 

Additional Inherited Members

- Protected Member Functions inherited from OgreNewt::Joint
void addLinearRow (const Ogre::Vector3 &pt0, const Ogre::Vector3 &pt1, const Ogre::Vector3 &dir) const
 
void addAngularRow (Ogre::Radian relativeAngleError, const Ogre::Vector3 &dir) const
 
void addGeneralRow (const Ogre::Vector3 &linear0, const Ogre::Vector3 &angular0, const Ogre::Vector3 &linear1, const Ogre::Vector3 &angular1) const
 
void setRowMinimumFriction (Ogre::Real friction) const
 
void setRowMaximumFriction (Ogre::Real friction) const
 
void setRowStiffness (Ogre::Real stiffness) const
 
void setRowAcceleration (Ogre::Real accel) const
 
void setRowSpringDamper (Ogre::Real springK, Ogre::Real springD) const
 
void SetSupportJoint (CustomJoint *supportJoint)
 SetSupportJoint.
 
CustomJoint * GetSupportJoint () const
 GetSupportJoint.
 
- Static Protected Member Functions inherited from OgreNewt::Joint
static void _CDECL destructorCallback (const CustomJoint *me)
 joint destructor callback glue
 
static void _CDECL submitConstraintCallback (const CustomJoint *me, dFloat timestep, int threadIndex)
 submintContraint
 

Detailed Description

hinge joint.

simple hinge joint. implement motors/limits through a callback.

Definition at line 144 of file OgreNewt_BasicJoints.h.

Member Enumeration Documentation

◆ ConstraintType

Enumerator
CONSTRAINT_NONE 
CONSTRAINT_OMEGA 
CONSTRAINT_ANGLE 
CONSTRAINT_BRAKE 

Definition at line 207 of file OgreNewt_BasicJoints.h.

Constructor & Destructor Documentation

◆ Hinge()

OgreNewt::Hinge::Hinge ( const OgreNewt::Body child,
const OgreNewt::Body parent,
const Ogre::Vector3 &  pos,
const Ogre::Vector3 &  pin 
)

constructor

Parameters
childpointer to the child rigid body.
parentpointer to the parent rigid body. pass NULL to make the world itself the parent (aka a rigid joint)
pindirection of the joint pin in global space

Definition at line 278 of file OgreNewt_BasicJoints.cpp.

◆ ~Hinge()

OgreNewt::Hinge::~Hinge ( )

destructor

Definition at line 306 of file OgreNewt_BasicJoints.cpp.

Member Function Documentation

◆ clearConstraints()

void OgreNewt::Hinge::clearConstraints ( )
inline

clears the motor constraints

Definition at line 202 of file OgreNewt_BasicJoints.h.

◆ enableLimits()

void OgreNewt::Hinge::enableLimits ( bool  state)

enable hinge limits.

Definition at line 311 of file OgreNewt_BasicJoints.cpp.

◆ enableMotor()

void OgreNewt::Hinge::enableMotor ( bool  state)

Definition at line 320 of file OgreNewt_BasicJoints.cpp.

◆ getJointAngle()

Ogre::Radian OgreNewt::Hinge::getJointAngle ( ) const

get the relative joint angle around the hinge pin.

Definition at line 415 of file OgreNewt_BasicJoints.cpp.

◆ getJointAngularVelocity()

Ogre::Radian OgreNewt::Hinge::getJointAngularVelocity ( ) const

get the relative joint angle around the hinge pin.

Definition at line 435 of file OgreNewt_BasicJoints.cpp.

◆ getJointForce()

Ogre::Vector3 OgreNewt::Hinge::getJointForce ( )

retrieve the current joint force.

This can be used to find the "stress" on the joint. you can do special effects like break the joint if the force exceedes some value, etc.

Definition at line 421 of file OgreNewt_BasicJoints.cpp.

◆ getJointPin()

Ogre::Vector3 OgreNewt::Hinge::getJointPin ( ) const

get the joint pin in global space

Definition at line 443 of file OgreNewt_BasicJoints.cpp.

◆ setBrake()

void OgreNewt::Hinge::setBrake ( Ogre::Real  maxForce = 0)

apply hinge brake for one frame.

Definition at line 402 of file OgreNewt_BasicJoints.cpp.

◆ setDesiredAngle()

void OgreNewt::Hinge::setDesiredAngle ( Ogre::Radian  angle,
Ogre::Real  minFriction = 0,
Ogre::Real  maxFriction = 0 
)

set desired angle and optionally minimum and maximum friction

Definition at line 378 of file OgreNewt_BasicJoints.cpp.

◆ setDesiredOmega()

void OgreNewt::Hinge::setDesiredOmega ( Ogre::Radian  omega,
Ogre::Real  strength = 0.5f 
)

sets desired rotational velocity of the joint

Definition at line 345 of file OgreNewt_BasicJoints.cpp.

◆ setLimits()

void OgreNewt::Hinge::setLimits ( Ogre::Radian  minAngle,
Ogre::Radian  maxAngle 
)

set minimum and maximum hinge limits.

Definition at line 330 of file OgreNewt_BasicJoints.cpp.

◆ setTorque()

void OgreNewt::Hinge::setTorque ( Ogre::Real  torque)

sets hinge torque

torque can be applied at the same time as other constraints (omega/angle/brake)

Parameters
torquetorque to apply

Definition at line 364 of file OgreNewt_BasicJoints.cpp.

◆ submitConstraint()

void OgreNewt::Hinge::submitConstraint ( Ogre::Real  timeStep,
int  threadIndex 
)
virtual

must be define for a functioning joint.

Reimplemented from OgreNewt::Joint.

Definition at line 451 of file OgreNewt_BasicJoints.cpp.

Member Data Documentation

◆ m_brakeMaxForce

Ogre::Real OgreNewt::Hinge::m_brakeMaxForce
protected

Definition at line 224 of file OgreNewt_BasicJoints.h.

◆ m_constraintType

ConstraintType OgreNewt::Hinge::m_constraintType
protected

Definition at line 209 of file OgreNewt_BasicJoints.h.

◆ m_desiredAngle

Ogre::Radian OgreNewt::Hinge::m_desiredAngle
protected

Definition at line 213 of file OgreNewt_BasicJoints.h.

◆ m_desiredOmega

Ogre::Radian OgreNewt::Hinge::m_desiredOmega
protected

Definition at line 212 of file OgreNewt_BasicJoints.h.

◆ m_lastConstraintType

ConstraintType OgreNewt::Hinge::m_lastConstraintType
protected

Definition at line 210 of file OgreNewt_BasicJoints.h.

◆ m_maxAngle

Ogre::Radian OgreNewt::Hinge::m_maxAngle
protected

Definition at line 218 of file OgreNewt_BasicJoints.h.

◆ m_minAngle

Ogre::Radian OgreNewt::Hinge::m_minAngle
protected

Definition at line 217 of file OgreNewt_BasicJoints.h.

◆ m_motorMaxFriction

Ogre::Real OgreNewt::Hinge::m_motorMaxFriction
protected

Definition at line 223 of file OgreNewt_BasicJoints.h.

◆ m_motorMinFriction

Ogre::Real OgreNewt::Hinge::m_motorMinFriction
protected

Definition at line 222 of file OgreNewt_BasicJoints.h.

◆ m_motorStrength

Ogre::Real OgreNewt::Hinge::m_motorStrength
protected

Definition at line 220 of file OgreNewt_BasicJoints.h.

◆ m_motorTorque

Ogre::Real OgreNewt::Hinge::m_motorTorque
protected

Definition at line 221 of file OgreNewt_BasicJoints.h.

◆ m_torqueOn

bool OgreNewt::Hinge::m_torqueOn
protected

Definition at line 226 of file OgreNewt_BasicJoints.h.

◆ m_useLimits

bool OgreNewt::Hinge::m_useLimits
protected

Definition at line 215 of file OgreNewt_BasicJoints.h.

◆ m_useMotor

bool OgreNewt::Hinge::m_useMotor
protected

Definition at line 216 of file OgreNewt_BasicJoints.h.


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