#include <OgreRefAppApplicationObject.h>
Public Member Functions | |
virtual void | setPosition (const Vector3 &vec) |
virtual void | setPosition (Real x, Real y, Real z) |
virtual void | setOrientation (const Quaternion &orientation) |
virtual const Vector3 & | getPosition (void) |
virtual const Quaternion & | getOrientation (void) |
virtual void | _updateFromDynamics (void) |
Updates the position of this game object from the simulation. | |
virtual bool | isCollisionEnabled (void) |
Returns whether or not this object is considered for collision. | |
virtual bool | isDynamicsEnabled (void) |
virtual void | setDynamicsDisableThreshold (Real linearSq, Real angularSq, Real overTime) |
virtual void | setDynamicsEnabled (bool enabled, bool reEnableOnInteraction=false) |
virtual void | setBounceParameters (Real restitutionValue, Real velocityThreshold) |
virtual Real | getBounceRestitutionValue (void) |
virtual Real | getBounceVelocityThreshold (void) |
virtual void | setSoftness (Real softness) |
virtual Real | getSoftness (void) |
virtual void | setFriction (Real friction) |
virtual Real | getFriction (void) |
virtual void | addForce (const Vector3 &direction, const Vector3 &atPosition=Vector3::ZERO) |
virtual void | addForce (Real dir_x, Real dir_y, Real dir_z, Real pos_x=0, Real pos_y=0, Real pos_z=0) |
virtual void | addForceWorldSpace (const Vector3 &direction, const Vector3 &atPosition=Vector3::ZERO) |
virtual void | addForceWorldSpace (Real dir_x, Real dir_y, Real dir_z, Real pos_x, Real pos_y, Real pos_z) |
virtual void | addTorque (const Vector3 &direction) |
virtual void | addTorque (Real x, Real y, Real z) |
virtual void | addTorqueWorldSpace (const Vector3 &direction) |
virtual void | addTorqueWorldSpace (Real x, Real y, Real z) |
virtual bool | testCollide (ApplicationObject *otherObj) |
virtual bool | testCollide (SceneQuery::WorldFragment *wf) |
virtual void | _notifyCollided (ApplicationObject *otherObj, const CollisionInfo &info) |
virtual void | _notifyCollided (SceneQuery::WorldFragment *wf, const CollisionInfo &info) |
SceneNode * | getSceneNode (void) |
Entity * | getEntity (void) |
dBody * | getOdeBody (void) |
void | setMassSphere (Real density, Real radius) |
void | setMassBox (Real density, const Vector3 &dimensions, const Quaternion &orientation=Quaternion::IDENTITY) |
void | setMassCappedCylinder (Real density, Real length, Real width, const Quaternion &orientation=Quaternion::IDENTITY) |
void | setMassExpert (Real mass, const Vector3 center, const Matrix3 inertia) |
const dMass * | getOdeMass (void) |
void | setLinearVelocity (const Vector3 &vel) |
void | setLinearVelocity (Real x, Real y, Real z) |
const Vector3 & | getLinearVelocity (void) |
const Vector3 & | getAngularVelocity (void) |
void | setAngularVelocity (const Vector3 &vel) |
void | setAngularVelocity (Real x, Real y, Real z) |
virtual void | translate (const Vector3 &d) |
virtual void | translate (Real x, Real y, Real z) |
virtual void | translateWorldSpace (const Vector3 &d) |
virtual void | translateWorldSpace (Real x, Real y, Real z) |
virtual void | roll (const Radian &angle) |
virtual void | pitch (const Radian &angle) |
virtual void | yaw (const Radian &angle) |
virtual void | rotate (const Vector3 &axis, const Radian &angle) |
virtual void | rotate (const Quaternion &q) |
Protected Types | |
typedef std::list< dGeom * > | CollisionProxyList |
Collision proxies, must be set up if collision enabled. | |
Protected Member Functions | |
virtual void | updateCollisionProxies (void) |
virtual bool | testCollidePlaneBounds (SceneQuery::WorldFragment *wf) |
virtual void | setEntityQueryFlags (void) |
Internal method for updating the query mask. | |
Protected Attributes | |
dBody * | mOdeBody |
Dynamics properties, must be set up by subclasses if dynamics enabled. | |
dMass | mMass |
Mass parameters. | |
Classes | |
struct | CollisionInfo |
It extends the OGRE UserDefinedObject to allow reverse links from Ogre::Entity. Note that this class does not override the UserDefinedObject's getTypeId method because this class is abstract.
void OgreRefApp::ApplicationObject::updateCollisionProxies | ( | void | ) | [protected, virtual] |
Internal method for updating the state of the collision proxies.
bool OgreRefApp::ApplicationObject::testCollidePlaneBounds | ( | SceneQuery::WorldFragment * | wf | ) | [protected, virtual] |
Internal method for testing the plane bounded region WorldFragment type.
void OgreRefApp::ApplicationObject::setPosition | ( | const Vector3 & | vec | ) | [virtual] |
Sets the position of this object.
void OgreRefApp::ApplicationObject::setPosition | ( | Real | x, | |
Real | y, | |||
Real | z | |||
) | [virtual] |
Sets the position of this object.
void OgreRefApp::ApplicationObject::setOrientation | ( | const Quaternion & | orientation | ) | [virtual] |
Sets the orientation of this object.
Reimplemented in OgreRefApp::CollideCamera.
const Vector3 & OgreRefApp::ApplicationObject::getPosition | ( | void | ) | [virtual] |
Gets the current position of this object.
const Quaternion & OgreRefApp::ApplicationObject::getOrientation | ( | void | ) | [virtual] |
Gets the current orientation of this object.
Reimplemented in OgreRefApp::CollideCamera.
bool OgreRefApp::ApplicationObject::isDynamicsEnabled | ( | void | ) | [virtual] |
Returns whether or not this object is physically simulated.
void OgreRefApp::ApplicationObject::setDynamicsDisableThreshold | ( | Real | linearSq, | |
Real | angularSq, | |||
Real | overTime | |||
) | [virtual] |
Sets whether or not this object is considered for collision.
These thresholds are used to speed up the simulation and to make it more stable, by turning off dynamics for objects that appear to be at rest. Otherwise, objects which are supposedly stationary can jitter when involved in large stacks, and can consume unnecessary CPU time. Note that if another object interacts with the disabled object, it will automatically reenable itself.
linearSq | The squared linear velocity magnitude threshold | |
angularSq | The squared angular velocity magnitude threshold | |
overTime | The number of seconds over which the values must continue to be under this threshold for the dynamics to be disabled. This is to catch cases where the object almost stops moving because of a boundary condition, but would speed up again later (e.g. box teetering on an edge). |
void OgreRefApp::ApplicationObject::setDynamicsEnabled | ( | bool | enabled, | |
bool | reEnableOnInteraction = false | |||
) | [virtual] |
Sets whether or not this object is physically simulated at this time.
enabled | Specifies whether dynamics is enabled | |
reEnableOnInteraction | If set to true, this object will reenable if some other dynamically simulated object interacts with it |
void OgreRefApp::ApplicationObject::setBounceParameters | ( | Real | restitutionValue, | |
Real | velocityThreshold | |||
) | [virtual] |
Sets the 'bounciness' of this object.
restitutionValue | Coeeficient of restitution (0 for no bounce, 1 for perfect bounciness) | |
velocityThreshold | Velocity below which no bounce will occur; this is a dampening value to ensure small velocities do not cause bounce. |
Real OgreRefApp::ApplicationObject::getBounceRestitutionValue | ( | void | ) | [virtual] |
Gets the cefficient of restitution (bounciness) for this object.
Real OgreRefApp::ApplicationObject::getBounceVelocityThreshold | ( | void | ) | [virtual] |
Gets the bounce velocity threshold for this object.
void OgreRefApp::ApplicationObject::setSoftness | ( | Real | softness | ) | [virtual] |
Sets the softness of this object, which determines how much it is allowed to penetrate other objects.
softness | Softness factor (0 is completely hard). Softness will be combined from both objects involved in a collision to determine how much they will penetrate. |
Real OgreRefApp::ApplicationObject::getSoftness | ( | void | ) | [virtual] |
Gets the softness factor of this object.
void OgreRefApp::ApplicationObject::setFriction | ( | Real | friction | ) | [virtual] |
Sets the Coulomb frictional coefficient for this object.
friction | The Coulomb friction coefficient, valid from 0 to Math::POS_INFINITY. 0 means no friction, Math::POS_INFINITY means infinite friction ie no slippage. Note that friction between these 2 bounds is more CPU intensive so use with caution. |
Real OgreRefApp::ApplicationObject::getFriction | ( | void | ) | [virtual] |
Gets the Coulomb frictional coefficient for this object.
void OgreRefApp::ApplicationObject::addForce | ( | const Vector3 & | direction, | |
const Vector3 & | atPosition = Vector3::ZERO | |||
) | [virtual] |
Adds a linear force to this object, in object space, at the position indicated.
direction | The force direction in object coordinates. | |
atPosition | The position at which the force is to be applied, in object coordinates. |
void OgreRefApp::ApplicationObject::addForce | ( | Real | dir_x, | |
Real | dir_y, | |||
Real | dir_z, | |||
Real | pos_x = 0 , |
|||
Real | pos_y = 0 , |
|||
Real | pos_z = 0 | |||
) | [virtual] |
Adds a linear force to this object, in object space, at the position indicated.
dir_x,dir_y,dir_z | The force direction in object coordinates. | |
pos_x,pos_y,pos_z | The position at which the force is to be applied, in object coordinates. |
void OgreRefApp::ApplicationObject::addForceWorldSpace | ( | const Vector3 & | direction, | |
const Vector3 & | atPosition = Vector3::ZERO | |||
) | [virtual] |
Adds a linear force to this object, in world space, at the position indicated.
direction | The force direction in world coordinates. | |
atPosition | The position at which the force is to be applied, in world coordinates. |
void OgreRefApp::ApplicationObject::addForceWorldSpace | ( | Real | dir_x, | |
Real | dir_y, | |||
Real | dir_z, | |||
Real | pos_x, | |||
Real | pos_y, | |||
Real | pos_z | |||
) | [virtual] |
Adds a linear force to this object, in world space, at the position indicated.
dir_x,dir_y,dir_z | The force direction in world coordinates. | |
pos_x,pos_y,pos_z | The position at which the force is to be applied, in world coordinates. |
void OgreRefApp::ApplicationObject::addTorque | ( | const Vector3 & | direction | ) | [virtual] |
Adds rotational force to this object, in object space.
direction | The direction of the torque to apply, in object space. |
void OgreRefApp::ApplicationObject::addTorque | ( | Real | x, | |
Real | y, | |||
Real | z | |||
) | [virtual] |
Adds rotational force to this object, in object space.
x,y,z | The direction of the torque to apply, in object space. |
void OgreRefApp::ApplicationObject::addTorqueWorldSpace | ( | const Vector3 & | direction | ) | [virtual] |
Adds rotational force to this object, in world space.
direction | The direction of the torque to apply, in world space. |
void OgreRefApp::ApplicationObject::addTorqueWorldSpace | ( | Real | x, | |
Real | y, | |||
Real | z | |||
) | [virtual] |
Adds rotational force to this object, in world space.
x,y,z | The direction of the torque to apply, in world space. |
bool OgreRefApp::ApplicationObject::testCollide | ( | ApplicationObject * | otherObj | ) | [virtual] |
Tests to see if there is a detailed collision between this object and the object passed in.
bool OgreRefApp::ApplicationObject::testCollide | ( | SceneQuery::WorldFragment * | wf | ) | [virtual] |
Tests to see if there is a detailed collision between this object and the world fragment passed in.
void OgreRefApp::ApplicationObject::_notifyCollided | ( | ApplicationObject * | otherObj, | |
const CollisionInfo & | info | |||
) | [virtual] |
This method is called automatically if testCollide indicates a real collision.
Reimplemented in OgreRefApp::Character, OgreRefApp::CollideCamera, OgreRefApp::Fire, and OgreRefApp::NPC.
void OgreRefApp::ApplicationObject::_notifyCollided | ( | SceneQuery::WorldFragment * | wf, | |
const CollisionInfo & | info | |||
) | [virtual] |
This method is called automatically if testCollide indicates a real collision.
Reimplemented in OgreRefApp::Character, OgreRefApp::CollideCamera, OgreRefApp::Fire, and OgreRefApp::NPC.
SceneNode * OgreRefApp::ApplicationObject::getSceneNode | ( | void | ) |
Gets the SceneNode which is being used to represent this object's position in the OGRE world.
Entity * OgreRefApp::ApplicationObject::getEntity | ( | void | ) |
Gets the Entity which is being used to represent this object in the OGRE world.
dBody * OgreRefApp::ApplicationObject::getOdeBody | ( | void | ) |
Gets the ODE body used to represent this object's mass and current velocity.
void OgreRefApp::ApplicationObject::setMassSphere | ( | Real | density, | |
Real | radius | |||
) |
Set the mass parameters of this object to represent a sphere.
density | Density of the sphere in Kg/m^3 | |
radius | of the sphere mass |
void OgreRefApp::ApplicationObject::setMassBox | ( | Real | density, | |
const Vector3 & | dimensions, | |||
const Quaternion & | orientation = Quaternion::IDENTITY | |||
) |
Set the mass parameters of this object to represent a box.
density | Density of the box in Kg/m^3 | |
dimensions | Width, height and depth of the box. | |
orientation | Optional orientation of the box. |
void OgreRefApp::ApplicationObject::setMassCappedCylinder | ( | Real | density, | |
Real | length, | |||
Real | width, | |||
const Quaternion & | orientation = Quaternion::IDENTITY | |||
) |
Set the mass parameters of this object to represent a capped cylinder.
density | Density of the cylinder in Kg/m^3 | |
length | Length of the cylinder | |
width | Width of the cylinder | |
orientation | Optional orientation if you wish the cylinder to lay along a different axis from Z. |
void OgreRefApp::ApplicationObject::setMassExpert | ( | Real | mass, | |
const Vector3 | center, | |||
const Matrix3 | inertia | |||
) |
Sets the mass parameters manually, use only if you know how!
mass | Mass in Kg | |
center | The center of gravity | |
inertia | The inertia matrix describing distribution of the mass around the body. |
const dMass * OgreRefApp::ApplicationObject::getOdeMass | ( | void | ) |
Gets the ODE mass parameters for this object.
void OgreRefApp::ApplicationObject::setLinearVelocity | ( | const Vector3 & | vel | ) |
Sets the current linear velocity of this object.
void OgreRefApp::ApplicationObject::setLinearVelocity | ( | Real | x, | |
Real | y, | |||
Real | z | |||
) |
Sets the current linear velocity of this object.
const Vector3 & OgreRefApp::ApplicationObject::getLinearVelocity | ( | void | ) |
Gets the current linear velocity of this object.
const Vector3 & OgreRefApp::ApplicationObject::getAngularVelocity | ( | void | ) |
Gets the current angular velocity of this object.
void OgreRefApp::ApplicationObject::setAngularVelocity | ( | const Vector3 & | vel | ) |
Sets the current angular velocity of this object.
void OgreRefApp::ApplicationObject::setAngularVelocity | ( | Real | x, | |
Real | y, | |||
Real | z | |||
) |
Sets the current angular velocity of this object.
void OgreRefApp::ApplicationObject::translate | ( | const Vector3 & | d | ) | [virtual] |
Moves the object along it's local axes.
d | Vector with x,y,z values representing the translation. |
Reimplemented in OgreRefApp::CollideCamera.
void OgreRefApp::ApplicationObject::translate | ( | Real | x, | |
Real | y, | |||
Real | z | |||
) | [virtual] |
Moves the object along it's local axes.
x,y | z Real x, y and z values representing the translation. |
void OgreRefApp::ApplicationObject::translateWorldSpace | ( | const Vector3 & | d | ) | [virtual] |
Moves the object along the world axes.
d | Vector with x,y,z values representing the translation. |
void OgreRefApp::ApplicationObject::translateWorldSpace | ( | Real | x, | |
Real | y, | |||
Real | z | |||
) | [virtual] |
Moves the object along the world axes.
x,y | z Real x, y and z values representing the translation. |
void OgreRefApp::ApplicationObject::roll | ( | const Radian & | angle | ) | [virtual] |
Rotate the object around the local Z-axis.
Reimplemented in OgreRefApp::CollideCamera.
void OgreRefApp::ApplicationObject::pitch | ( | const Radian & | angle | ) | [virtual] |
Rotate the object around the local X-axis.
Reimplemented in OgreRefApp::CollideCamera.
void OgreRefApp::ApplicationObject::yaw | ( | const Radian & | angle | ) | [virtual] |
Rotate the object around the local Y-axis.
Reimplemented in OgreRefApp::CollideCamera.
void OgreRefApp::ApplicationObject::rotate | ( | const Vector3 & | axis, | |
const Radian & | angle | |||
) | [virtual] |
Rotate the object around an arbitrary axis.
Reimplemented in OgreRefApp::CollideCamera.
void OgreRefApp::ApplicationObject::rotate | ( | const Quaternion & | q | ) | [virtual] |
Rotate the object around an aritrary axis using a Quarternion.
Reimplemented in OgreRefApp::CollideCamera.