12#ifndef _INCLUDE_OGRENEWT_BASICJOINTS
13#define _INCLUDE_OGRENEWT_BASICJOINTS
43 Ogre::Vector3 getJointAngle();
46 Ogre::Vector3 getJointOmega();
52 Ogre::Vector3 getJointForce();
60 void setLimits(Ogre::Radian maxCone, Ogre::Radian minTwist, Ogre::Radian maxTwist);
84 Ogre::Vector3 getJointAngle();
87 Ogre::Vector3 getJointOmega();
93 Ogre::Vector3 getJointForce();
116 Ogre::Vector3 getJointAngle();
119 Ogre::Vector3 getJointOmega();
125 Ogre::Vector3 getJointForce();
127 void SetAngularVelocity(Ogre::Real omegaMag);
128 Ogre::Real GetAngularVelocity()
const;
130 void SetPitchAngle(Ogre::Real angle);
131 Ogre::Real GetPitchAngle()
const;
133 void SetYawAngle(Ogre::Real angle);
134 Ogre::Real GetYawAngle()
const;
136 void SetRollAngle(Ogre::Real angle);
137 Ogre::Real GetRollAngle()
const;
161 void enableLimits(
bool state);
163 void enableMotor(
bool state);
166 void setLimits(Ogre::Radian minAngle, Ogre::Radian maxAngle);
169 Ogre::Radian getJointAngle ()
const;
175 Ogre::Vector3 getJointForce();
178 Ogre::Radian getJointAngularVelocity ()
const;
181 Ogre::Vector3 getJointPin ()
const;
184 void setDesiredOmega(Ogre::Radian omega, Ogre::Real strength = 0.5f);
187 void setDesiredAngle(Ogre::Radian angle, Ogre::Real minFriction = 0, Ogre::Real maxFriction = 0);
194 void setTorque(Ogre::Real torque);
199 void setBrake(Ogre::Real maxForce = 0);
204 virtual void submitConstraint(Ogre::Real timestep,
int threadindex);
251 void enableLimits(
bool state);
253 void setFriction(Ogre::Real friction);
256 void enableMotor(
bool state);
258 void setMotorVelocity(Ogre::Real velocity, Ogre::Real strength);
261 void setLimits(Ogre::Real minStopDist, Ogre::Real maxStopDist);
264 void enableSpring(
bool state);
267 void setSpring(Ogre::Real springStrength, Ogre::Real springDamping);
273 Ogre::Vector3 getJointForce();
276 Ogre::Real getJointVelocity()
const;
278 Ogre::Real getDistance()
const;
280 virtual void submitConstraint(Ogre::Real timestep,
int threadindex);
285 Ogre::Real m_minDist;
286 Ogre::Real m_maxDist;
288 Ogre::Real m_springStrength;
289 Ogre::Real m_springDamping;
315 void setPin(
const Ogre::Vector3& pin );
318 const Ogre::Vector3& getPin()
const;
355 Ogre::Radian
getJointAngle0()
const {
return Ogre::Radian(NewtonUniversalGetJointAngle0( m_joint )); }
358 Ogre::Radian
getJointAngle1()
const {
return Ogre::Radian(NewtonUniversalGetJointAngle1( m_joint )); }
361 Ogre::Real
getJointOmega0()
const {
return (Ogre::Real)NewtonUniversalGetJointOmega0( m_joint ); }
364 Ogre::Real
getJointOmega1()
const {
return (Ogre::Real)NewtonUniversalGetJointOmega1( m_joint ); }
367 Ogre::Vector3 getJointForce()
const;
375 void setCallback( UniversalCallback callback ) { m_callback = callback; }
386 void setCallbackAccel( Ogre::Real accel,
unsigned axis );
394 void setCallbackFrictionMin( Ogre::Real min,
unsigned axis );
402 void setCallbackFrictionMax( Ogre::Real max,
unsigned axis );
408 Ogre::Real getCallbackTimestep()
const;
415 Ogre::Real calculateStopAlpha0( Ogre::Real angle )
const;
422 Ogre::Real calculateStopAlpha1( Ogre::Real angle )
const;
427 static unsigned _CDECL newtonCallback(
const NewtonJoint* universal, NewtonHingeSliderUpdateDesc* desc );
460 void setPin(
const Ogre::Vector3& pin )
const { NewtonUpVectorSetPin( m_joint, &pin.x ); }
469 namespace PrebuiltCustomJoints
488 virtual void submitConstraint( Ogre::Real timeStep,
int threadIndex );
494 void setLimits( Ogre::Degree min, Ogre::Degree max ) { mMin = min, mMax = max; }
503 void addAccel( Ogre::Real accel ) { mAccel = accel; }
514 Ogre::Quaternion mLocalOrient0, mLocalOrient1;
515 Ogre::Vector3 mLocalPos0, mLocalPos1;
538 virtual void submitConstraint( Ogre::Real timeStep,
int threadIndex );
541 Ogre::Vector3 mLocalPos0;
542 Ogre::Vector3 mLocalPos1;
544 Ogre::Quaternion mLocalOrient0;
545 Ogre::Quaternion mLocalOrient1;
598 void setPickingMode (
int mode);
604 void setMaxLinearFriction(Ogre::Real accel);
610 void setMaxAngularFriction(Ogre::Real alpha);
616 void setTargetPosit (
const Ogre::Vector3& position);
622 void setTargetRotation (
const Ogre::Quaternion& rotation);
629 void setTargetMatrix (
const Ogre::Vector3& position,
const Ogre::Quaternion& rotation);
636 void getTargetMatrix (Ogre::Vector3& position, Ogre::Quaternion& rotation)
const;
main class for all Rigid Bodies in the system.
Ogre::Real m_motorMinFriction
Ogre::Real m_motorMaxFriction
Ogre::Radian m_desiredAngle
ConstraintType m_constraintType
Ogre::Real m_motorStrength
Ogre::Radian m_desiredOmega
void clearConstraints()
clears the motor constraints
Ogre::Real m_brakeMaxForce
ConstraintType m_lastConstraintType
base class for all joints.
Kinematic controller joint.
void setLimits(Ogre::Degree min, Ogre::Degree max)
set rotational limits for the joint.
Ogre::Vector3 getPin()
get the pin.
~Custom2DJoint()
destructor
bool getLimitsOn() const
returns whether limits are turned on or off for the joint.
Ogre::Radian getAngle() const
get the current angle of the joint.
void addAccel(Ogre::Real accel)
adds rotational acceleration to the joint (like a motor)
void setLimitsOn(bool onoff)
sets whether to enable limits or not for the joint.
this class represents a Universal joint.
void setCallback(UniversalCallback callback)
set a custom callback for controlling this joint.
NewtonHingeSliderUpdateDesc * m_desc
Ogre::Radian getJointAngle0() const
get the angle around pin0.
Ogre::Real getJointOmega0() const
get the rotational velocity around pin0.
UniversalCallback m_callback
Ogre::Real getJointOmega1() const
get the rotational velocity around pin1.
Ogre::Radian getJointAngle1() const
get the angle around pin1.
Ogre::Vector3 getPin() const
get the current pin direction.
void setPin(const Ogre::Vector3 &pin) const
set the pin direction.
represents a physics world.