SO3Engine
Public Types | Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
OgreNewt::Universal Class Reference

this class represents a Universal joint. More...

#include <OgreNewt_BasicJoints.h>

Inheritance diagram for OgreNewt::Universal:
OgreNewt::Joint

Public Types

typedef void(* UniversalCallback) (Universal *me)
 custom universal callback function.
 

Public Member Functions

 Universal (const World *world, const OgreNewt::Body *child, const OgreNewt::Body *parent, const Ogre::Vector3 &pos, const Ogre::Vector3 &pin0, const Ogre::Vector3 &pin1)
 constructor
 
 ~Universal ()
 destructor
 
Ogre::Radian getJointAngle0 () const
 get the angle around pin0.
 
Ogre::Radian getJointAngle1 () const
 get the angle around pin1.
 
Ogre::Real getJointOmega0 () const
 get the rotational velocity around pin0.
 
Ogre::Real getJointOmega1 () const
 get the rotational velocity around pin1.
 
Ogre::Vector3 getJointForce () const
 get the force on the joint.
 
void setCallback (UniversalCallback callback)
 set a custom callback for controlling this joint.
 
void setCallbackAccel (Ogre::Real accel, unsigned axis)
 set the acceleration around a particular pin.
 
void setCallbackFrictionMin (Ogre::Real min, unsigned axis)
 set the minimum friction around a particular pin
 
void setCallbackFrictionMax (Ogre::Real max, unsigned axis)
 set the maximum friction around a particular pin.
 
Ogre::Real getCallbackTimestep () const
 get the current phsics timestep.
 
Ogre::Real calculateStopAlpha0 (Ogre::Real angle) const
 calculate the acceleration neccesary to stop the joint at the specified angle on pin 0.
 
Ogre::Real calculateStopAlpha1 (Ogre::Real angle) const
 calculate the acceleration neccesary to stop the joint at the specified angle on pin 1.
 
- 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 submitConstraint (Ogre::Real timeStep, int threadIndex)
 must be define for a functioning joint.
 
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
 

Static Protected Member Functions

static unsigned _CDECL newtonCallback (const NewtonJoint *universal, NewtonHingeSliderUpdateDesc *desc)
 newton callback. used internally.
 
- 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
 

Protected Attributes

UniversalCallback m_callback
 
NewtonHingeSliderUpdateDesc * m_desc
 
unsigned m_retval
 
- 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.
 

Detailed Description

this class represents a Universal joint.

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

Definition at line 329 of file OgreNewt_BasicJoints.h.

Member Typedef Documentation

◆ UniversalCallback

typedef void(* OgreNewt::Universal::UniversalCallback) (Universal *me)

custom universal callback function.

use the setCallback() function to assign your custom function to the joint.

Definition at line 338 of file OgreNewt_BasicJoints.h.

Constructor & Destructor Documentation

◆ Universal()

OgreNewt::Universal::Universal ( const World world,
const OgreNewt::Body child,
const OgreNewt::Body parent,
const Ogre::Vector3 &  pos,
const Ogre::Vector3 &  pin0,
const Ogre::Vector3 &  pin1 
)

constructor

Parameters
worldpointer to the OgreNewt::World
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)
posposition of the joint in global space
pin0direction of the first axis of rotation in global space
pin1direction of the second axis of rotation in global space

Definition at line 928 of file OgreNewt_BasicJoints.cpp.

◆ ~Universal()

OgreNewt::Universal::~Universal ( )

destructor

Definition at line 950 of file OgreNewt_BasicJoints.cpp.

Member Function Documentation

◆ calculateStopAlpha0()

Ogre::Real OgreNewt::Universal::calculateStopAlpha0 ( Ogre::Real  angle) const

calculate the acceleration neccesary to stop the joint at the specified angle on pin 0.

For implementing joint limits. This command is only valid when used inside a custom callback.

Definition at line 1021 of file OgreNewt_BasicJoints.cpp.

◆ calculateStopAlpha1()

Ogre::Real OgreNewt::Universal::calculateStopAlpha1 ( Ogre::Real  angle) const

calculate the acceleration neccesary to stop the joint at the specified angle on pin 1.

For implementing joint limits. This command is only valid when used inside a custom callback.

Definition at line 1029 of file OgreNewt_BasicJoints.cpp.

◆ getCallbackTimestep()

Ogre::Real OgreNewt::Universal::getCallbackTimestep ( ) const

get the current phsics timestep.

Definition at line 1013 of file OgreNewt_BasicJoints.cpp.

◆ getJointAngle0()

Ogre::Radian OgreNewt::Universal::getJointAngle0 ( ) const
inline

get the angle around pin0.

Definition at line 355 of file OgreNewt_BasicJoints.h.

◆ getJointAngle1()

Ogre::Radian OgreNewt::Universal::getJointAngle1 ( ) const
inline

get the angle around pin1.

Definition at line 358 of file OgreNewt_BasicJoints.h.

◆ getJointForce()

Ogre::Vector3 OgreNewt::Universal::getJointForce ( ) const

get the force on the joint.

Definition at line 954 of file OgreNewt_BasicJoints.cpp.

◆ getJointOmega0()

Ogre::Real OgreNewt::Universal::getJointOmega0 ( ) const
inline

get the rotational velocity around pin0.

Definition at line 361 of file OgreNewt_BasicJoints.h.

◆ getJointOmega1()

Ogre::Real OgreNewt::Universal::getJointOmega1 ( ) const
inline

get the rotational velocity around pin1.

Definition at line 364 of file OgreNewt_BasicJoints.h.

◆ newtonCallback()

unsigned _CDECL OgreNewt::Universal::newtonCallback ( const NewtonJoint *  universal,
NewtonHingeSliderUpdateDesc *  desc 
)
staticprotected

newton callback. used internally.

Definition at line 963 of file OgreNewt_BasicJoints.cpp.

◆ setCallback()

void OgreNewt::Universal::setCallback ( UniversalCallback  callback)
inline

set a custom callback for controlling this joint.

Joint callbacks allow you to make complex joint behavior such as limits or motors. just make a custom static function that accepts a pointer to a OgreNewt::BasicJoints::Universal as the single parameter. this function will be called automatically every time you upate the World.

Definition at line 375 of file OgreNewt_BasicJoints.h.

◆ setCallbackAccel()

void OgreNewt::Universal::setCallbackAccel ( Ogre::Real  accel,
unsigned  axis 
)

set the acceleration around a particular pin.

Definition at line 980 of file OgreNewt_BasicJoints.cpp.

◆ setCallbackFrictionMax()

void OgreNewt::Universal::setCallbackFrictionMax ( Ogre::Real  max,
unsigned  axis 
)

set the maximum friction around a particular pin.

Definition at line 991 of file OgreNewt_BasicJoints.cpp.

◆ setCallbackFrictionMin()

void OgreNewt::Universal::setCallbackFrictionMin ( Ogre::Real  min,
unsigned  axis 
)

set the minimum friction around a particular pin

Definition at line 1002 of file OgreNewt_BasicJoints.cpp.

Member Data Documentation

◆ m_callback

UniversalCallback OgreNewt::Universal::m_callback
protected

Definition at line 429 of file OgreNewt_BasicJoints.h.

◆ m_desc

NewtonHingeSliderUpdateDesc* OgreNewt::Universal::m_desc
protected

Definition at line 430 of file OgreNewt_BasicJoints.h.

◆ m_retval

unsigned OgreNewt::Universal::m_retval
protected

Definition at line 432 of file OgreNewt_BasicJoints.h.


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