Sirikata
|
Implementation of BulletObject covering most types of rigid bodies -- static, dynamic, and linearly/vertically constrained. More...
#include <BulletRigidBodyObject.hpp>
Public Member Functions | |
BulletRigidBodyObject (BulletPhysicsService *parent, const UUID &uuid, bulletObjTreatment treatment=BULLET_OBJECT_TREATMENT_IGNORE, bulletObjBBox bb=BULLET_OBJECT_BOUNDS_SPHERE, float32 mass=1.f) | |
virtual | ~BulletRigidBodyObject () |
virtual bool | fixed () |
virtual bulletObjTreatment | treatment () |
virtual bulletObjBBox | bbox () |
virtual float32 | mass () |
virtual void | load (Mesh::MeshdataPtr mesh) |
After the mesh has been downloaded and parsed (or immediately if no mesh is required), this loads the object into the simulation. | |
virtual void | unload () |
Unload the object from the simulation. | |
virtual void | internalTick (const Time &t) |
Make modifications during an internal tick. | |
virtual void | deactivationTick (const Time &t) |
Check this object for deactivation. | |
virtual bool | applyRequestedLocation (const TimedMotionVector3f &loc, uint64 epoch) |
Try to apply the requested position to this object, updating the physics simulation if necessary. | |
virtual bool | applyRequestedOrientation (const TimedMotionQuaternion &orient, uint64 epoch) |
Try to apply the requested orientation to this object, updating the physics simulation if necessary. | |
virtual void | applyForcedLocation (const TimedMotionVector3f &loc, uint64 epoch) |
Apply the given position to this object. | |
virtual void | applyForcedOrientation (const TimedMotionQuaternion &orient, uint64 epoch) |
Apply the given orientation to this object. | |
void | updateBulletFromObject (btTransform &worldTrans) |
void | updateObjectFromBullet (const btTransform &worldTrans) |
Private Member Functions | |
void | addRigidBody () |
void | removeRigidBody () |
Private Attributes | |
UUID | mID |
bool | mFixed |
bulletObjTreatment | mTreatment |
bulletObjBBox | mBBox |
float32 | mMass |
btCollisionShape * | mObjShape |
SirikataMotionState * | mObjMotionState |
btRigidBody * | mObjRigidBody |
Implementation of BulletObject covering most types of rigid bodies -- static, dynamic, and linearly/vertically constrained.
Sirikata::BulletRigidBodyObject::BulletRigidBodyObject | ( | BulletPhysicsService * | parent, |
const UUID & | uuid, | ||
bulletObjTreatment | treatment = BULLET_OBJECT_TREATMENT_IGNORE , |
||
bulletObjBBox | bb = BULLET_OBJECT_BOUNDS_SPHERE , |
||
float32 | mass = 1.f |
||
) |
References Sirikata::BULLET_OBJECT_TREATMENT_CHARACTER, Sirikata::BULLET_OBJECT_TREATMENT_DYNAMIC, Sirikata::BULLET_OBJECT_TREATMENT_IGNORE, Sirikata::BULLET_OBJECT_TREATMENT_LINEAR_DYNAMIC, Sirikata::BULLET_OBJECT_TREATMENT_STATIC, Sirikata::BULLET_OBJECT_TREATMENT_VERTICAL_DYNAMIC, BULLETLOG, Sirikata::Logging::detailed, mFixed, and mMass.
Sirikata::BulletRigidBodyObject::~BulletRigidBodyObject | ( | ) | [virtual] |
References removeRigidBody().
void Sirikata::BulletRigidBodyObject::addRigidBody | ( | ) | [private] |
References Sirikata::BulletPhysicsService::addDeactivateableObject(), Sirikata::BulletPhysicsService::addInternalTickObject(), Sirikata::BULLET_OBJECT_TREATMENT_LINEAR_DYNAMIC, Sirikata::BULLET_OBJECT_TREATMENT_VERTICAL_DYNAMIC, Sirikata::BulletPhysicsService::dynamicsWorld(), Sirikata::BulletObject::getCollisionMask(), Sirikata::BulletPhysicsService::info(), Sirikata::PresenceProperties::location(), mID, mMass, mObjMotionState, mObjRigidBody, mObjShape, Sirikata::BulletObject::mParent, mTreatment, Sirikata::PresenceProperties::orientation(), Sirikata::LocationInfo::props, Sirikata::Quaternion::toAngleAxis(), Sirikata::TimedMotionQuaternion::velocity(), and Sirikata::TimedMotionVector< MotionVectorType >::velocity().
Referenced by load().
void Sirikata::BulletRigidBodyObject::applyForcedLocation | ( | const TimedMotionVector3f & | loc, |
uint64 | epoch | ||
) | [virtual] |
Apply the given position to this object.
This takes whatever steps are necessary to apply the change, even completely reloading the object in Bullet. This should only be used when absolutely necessary, e.g. for updates about remote, physically simulated objects.
Implements Sirikata::BulletObject.
References Sirikata::BulletPhysicsService::info(), mID, mObjMotionState, mObjRigidBody, Sirikata::BulletObject::mParent, Sirikata::LocationInfo::props, and Sirikata::SequencedPresenceProperties::setLocation().
Referenced by applyRequestedLocation().
void Sirikata::BulletRigidBodyObject::applyForcedOrientation | ( | const TimedMotionQuaternion & | orient, |
uint64 | epoch | ||
) | [virtual] |
Apply the given orientation to this object.
This takes whatever steps are necessary to apply the change, even completely reloading the object in Bullet. This should only be used when absolutely necessary, e.g. for updates about remote, physically simulated objects.
Implements Sirikata::BulletObject.
References Sirikata::BulletPhysicsService::info(), mID, mObjMotionState, mObjRigidBody, Sirikata::BulletObject::mParent, Sirikata::LocationInfo::props, and Sirikata::SequencedPresenceProperties::setOrientation().
Referenced by applyRequestedOrientation().
bool Sirikata::BulletRigidBodyObject::applyRequestedLocation | ( | const TimedMotionVector3f & | loc, |
uint64 | epoch | ||
) | [virtual] |
Try to apply the requested position to this object, updating the physics simulation if necessary.
Some types of objects may always fail to apply updates. Returns true if the update was applied and an update will need to be sent.
Implements Sirikata::BulletObject.
References applyForcedLocation(), Sirikata::BULLET_OBJECT_TREATMENT_STATIC, and mTreatment.
bool Sirikata::BulletRigidBodyObject::applyRequestedOrientation | ( | const TimedMotionQuaternion & | orient, |
uint64 | epoch | ||
) | [virtual] |
Try to apply the requested orientation to this object, updating the physics simulation if necessary.
Some types of objects may always fail to apply updates. Returns true if the update was applied and an update will need to be sent.
Implements Sirikata::BulletObject.
References applyForcedOrientation(), Sirikata::BULLET_OBJECT_TREATMENT_STATIC, and mTreatment.
boost::any Sirikata::Graphics::OgreSystem::bbox | ( | ) | [inline, virtual] |
Implements Sirikata::BulletObject.
References mBBox.
void Sirikata::BulletRigidBodyObject::deactivationTick | ( | const Time & | t | ) | [virtual] |
Check this object for deactivation.
Implementations should call BulletPhysicsService::updateObjectFromDeactivation if the object has been deactivated.
Reimplemented from Sirikata::BulletObject.
References mID, mObjRigidBody, Sirikata::BulletObject::mParent, and Sirikata::BulletPhysicsService::updateObjectFromDeactivation().
virtual bool Sirikata::BulletRigidBodyObject::fixed | ( | ) | [inline, virtual] |
Implements Sirikata::BulletObject.
References mFixed.
void Sirikata::BulletRigidBodyObject::internalTick | ( | const Time & | t | ) | [virtual] |
Make modifications during an internal tick.
Useful for capping speed and rotational speed.
Reimplemented from Sirikata::BulletObject.
References mObjRigidBody.
void Sirikata::BulletRigidBodyObject::load | ( | Mesh::MeshdataPtr | mesh | ) | [virtual] |
After the mesh has been downloaded and parsed (or immediately if no mesh is required), this loads the object into the simulation.
This should setup any Bullet state and start the physical simulation on the object.
Implements Sirikata::BulletObject.
References addRigidBody(), Sirikata::BulletObject::computeCollisionShape(), mBBox, mID, mObjShape, and mTreatment.
virtual float32 Sirikata::BulletRigidBodyObject::mass | ( | ) | [inline, virtual] |
Implements Sirikata::BulletObject.
References mMass.
void Sirikata::BulletRigidBodyObject::removeRigidBody | ( | ) | [private] |
References Sirikata::BulletPhysicsService::dynamicsWorld(), mID, mObjMotionState, mObjRigidBody, mObjShape, Sirikata::BulletObject::mParent, Sirikata::BulletPhysicsService::removeDeactivateableObject(), and Sirikata::BulletPhysicsService::removeInternalTickObject().
Referenced by unload(), and ~BulletRigidBodyObject().
virtual bulletObjTreatment Sirikata::BulletRigidBodyObject::treatment | ( | ) | [inline, virtual] |
Implements Sirikata::BulletObject.
References mTreatment.
void Sirikata::BulletRigidBodyObject::unload | ( | ) | [virtual] |
Unload the object from the simulation.
Implements Sirikata::BulletObject.
References removeRigidBody().
void Sirikata::BulletRigidBodyObject::updateBulletFromObject | ( | btTransform & | worldTrans | ) |
References Sirikata::BulletPhysicsService::currentOrientation(), Sirikata::BulletPhysicsService::currentPosition(), mID, Sirikata::BulletObject::mParent, Sirikata::Vector4< scalar >::w, Sirikata::Vector4< scalar >::x, Sirikata::Vector4< scalar >::y, and Sirikata::Vector4< scalar >::z.
Referenced by Sirikata::SirikataMotionState::getWorldTransform().
void Sirikata::BulletRigidBodyObject::updateObjectFromBullet | ( | const btTransform & | worldTrans | ) |
References Sirikata::BulletPhysicsService::addUpdate(), BULLETLOG, Sirikata::LocationService::context(), Sirikata::BulletPhysicsService::info(), Sirikata::Logging::insane, mFixed, mID, mObjRigidBody, Sirikata::BulletObject::mParent, Sirikata::BulletPhysicsService::setLocation(), Sirikata::BulletPhysicsService::setOrientation(), and Sirikata::Context::simTime().
Referenced by Sirikata::SirikataMotionState::setWorldTransform().
bool Sirikata::BulletRigidBodyObject::mFixed [private] |
Referenced by BulletRigidBodyObject(), fixed(), and updateObjectFromBullet().
UUID Sirikata::BulletRigidBodyObject::mID [private] |
float32 Sirikata::BulletRigidBodyObject::mMass [private] |
Referenced by addRigidBody(), BulletRigidBodyObject(), and mass().
Referenced by addRigidBody(), applyForcedLocation(), applyForcedOrientation(), and removeRigidBody().
btRigidBody* Sirikata::BulletRigidBodyObject::mObjRigidBody [private] |
btCollisionShape* Sirikata::BulletRigidBodyObject::mObjShape [private] |
Referenced by addRigidBody(), load(), and removeRigidBody().
Referenced by addRigidBody(), applyRequestedLocation(), applyRequestedOrientation(), load(), and treatment().