Sirikata
|
Implementation of BulletObject for characters. More...
#include <BulletCharacterObject.hpp>
Public Member Functions | |
BulletCharacterObject (BulletPhysicsService *parent, const UUID &uuid, bulletObjBBox bb=BULLET_OBJECT_BOUNDS_SPHERE) | |
virtual | ~BulletCharacterObject () |
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 | preTick (const Time &t) |
Make modifications before a full tick. | |
virtual void | postTick (const Time &t) |
Make modifications before a full 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. | |
Private Attributes | |
UUID | mID |
bulletObjBBox | mBBox |
btPairCachingGhostObject * | mGhostObject |
BulletCharacterController * | mCharacter |
btCollisionShape * | mCollisionShape |
Implementation of BulletObject for characters.
Characters behave differently than other physical objects -- they try to stay on the ground and fall like normal objects, but we don't want them to rotate, want them to slide against the ground and walls, etc.
Sirikata::BulletCharacterObject::BulletCharacterObject | ( | BulletPhysicsService * | parent, |
const UUID & | uuid, | ||
bulletObjBBox | bb = BULLET_OBJECT_BOUNDS_SPHERE |
||
) |
Sirikata::BulletCharacterObject::~BulletCharacterObject | ( | ) | [virtual] |
void Sirikata::BulletCharacterObject::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::currentPosition(), Sirikata::BulletPhysicsService::info(), mGhostObject, mID, Sirikata::BulletObject::mParent, Sirikata::LocationInfo::props, and Sirikata::SequencedPresenceProperties::setLocation().
Referenced by applyRequestedLocation().
void Sirikata::BulletCharacterObject::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::currentOrientation(), Sirikata::BulletPhysicsService::info(), mGhostObject, mID, Sirikata::BulletObject::mParent, Sirikata::LocationInfo::props, Sirikata::SequencedPresenceProperties::setOrientation(), Sirikata::Vector4< scalar >::w, Sirikata::Vector4< scalar >::x, Sirikata::Vector4< scalar >::y, and Sirikata::Vector4< scalar >::z.
Referenced by applyRequestedOrientation().
bool Sirikata::BulletCharacterObject::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().
bool Sirikata::BulletCharacterObject::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().
bulletObjBBox Sirikata::BulletCharacterObject::bbox | ( | ) | [virtual] |
Implements Sirikata::BulletObject.
References mBBox.
void Sirikata::BulletCharacterObject::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 mGhostObject, mID, Sirikata::BulletObject::mParent, and Sirikata::BulletPhysicsService::updateObjectFromDeactivation().
bool Sirikata::BulletCharacterObject::fixed | ( | ) | [virtual] |
Implements Sirikata::BulletObject.
void Sirikata::BulletCharacterObject::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 Sirikata::BulletPhysicsService::addDeactivateableObject(), Sirikata::BulletPhysicsService::addTickObject(), Sirikata::BulletPhysicsService::broadphase(), Sirikata::BULLET_OBJECT_TREATMENT_CHARACTER, Sirikata::BulletObject::computeCollisionShape(), Sirikata::BulletPhysicsService::currentOrientation(), Sirikata::BulletPhysicsService::currentPosition(), Sirikata::BulletPhysicsService::dynamicsWorld(), Sirikata::BulletObject::getCollisionMask(), Sirikata::BulletPhysicsService::info(), mBBox, mCharacter, mCollisionShape, mGhostObject, mID, Sirikata::BulletObject::mParent, Sirikata::Vector4< scalar >::w, Sirikata::Vector4< scalar >::x, Sirikata::Vector4< scalar >::y, and Sirikata::Vector4< scalar >::z.
float32 Sirikata::BulletCharacterObject::mass | ( | ) | [virtual] |
Implements Sirikata::BulletObject.
void Sirikata::BulletCharacterObject::postTick | ( | const Time & | t | ) | [virtual] |
Make modifications before a full tick.
Reimplemented from Sirikata::BulletObject.
References Sirikata::BulletPhysicsService::addUpdate(), Sirikata::BulletPhysicsService::info(), Sirikata::BulletPhysicsService::location(), Sirikata::PresenceProperties::location(), mGhostObject, mID, Sirikata::BulletObject::mParent, Sirikata::BulletPhysicsService::orientation(), Sirikata::PresenceProperties::orientation(), Sirikata::TimedMotionQuaternion::position(), Sirikata::TimedMotionVector< MotionVectorType >::position(), Sirikata::LocationInfo::props, Sirikata::BulletPhysicsService::setLocation(), Sirikata::BulletPhysicsService::setOrientation(), Sirikata::TimedMotionQuaternion::velocity(), and Sirikata::TimedMotionVector< MotionVectorType >::velocity().
void Sirikata::BulletCharacterObject::preTick | ( | const Time & | t | ) | [virtual] |
Make modifications before a full tick.
Reimplemented from Sirikata::BulletObject.
References Sirikata::BulletPhysicsService::currentOrientation(), Sirikata::BulletPhysicsService::info(), Sirikata::PresenceProperties::location(), mCharacter, mGhostObject, mID, Sirikata::BulletObject::mParent, Sirikata::LocationInfo::props, Sirikata::BulletCharacterController::setWalkDirection(), Sirikata::TimedMotionVector< MotionVectorType >::velocity(), Sirikata::Vector4< scalar >::w, Sirikata::Vector4< scalar >::x, Sirikata::Vector4< scalar >::y, and Sirikata::Vector4< scalar >::z.
bulletObjTreatment Sirikata::BulletCharacterObject::treatment | ( | ) | [virtual] |
Implements Sirikata::BulletObject.
References Sirikata::BULLET_OBJECT_TREATMENT_CHARACTER.
void Sirikata::BulletCharacterObject::unload | ( | ) | [virtual] |
Unload the object from the simulation.
Implements Sirikata::BulletObject.
References Sirikata::BulletPhysicsService::dynamicsWorld(), mCharacter, mCollisionShape, mGhostObject, mID, Sirikata::BulletObject::mParent, Sirikata::BulletPhysicsService::removeDeactivateableObject(), and Sirikata::BulletPhysicsService::removeTickObject().
Referenced by bbox(), BulletCharacterObject(), and load().
btCollisionShape* Sirikata::BulletCharacterObject::mCollisionShape [private] |
btPairCachingGhostObject* Sirikata::BulletCharacterObject::mGhostObject [private] |
Referenced by applyForcedLocation(), applyForcedOrientation(), deactivationTick(), load(), postTick(), preTick(), and unload().
UUID Sirikata::BulletCharacterObject::mID [private] |
Referenced by applyForcedLocation(), applyForcedOrientation(), deactivationTick(), load(), postTick(), preTick(), and unload().