namechange MotionType to PhysicsMotionType

This commit is contained in:
Andrew Meadows 2016-01-13 13:42:49 -08:00
parent 210b3ba1ec
commit 8b420adbc8
7 changed files with 18 additions and 18 deletions

View file

@ -41,7 +41,7 @@ void AvatarMotionState::clearIncomingDirtyFlags() {
}
}
MotionType AvatarMotionState::computeObjectMotionType() const {
PhysicsMotionType AvatarMotionState::computePhysicsMotionType() const {
// TODO?: support non-DYNAMIC motion for avatars? (e.g. when sitting)
return MOTION_TYPE_DYNAMIC;
}

View file

@ -22,12 +22,12 @@ class AvatarMotionState : public ObjectMotionState {
public:
AvatarMotionState(Avatar* avatar, btCollisionShape* shape);
virtual MotionType getMotionType() const override { return _motionType; }
virtual PhysicsMotionType getMotionType() const override { return _motionType; }
virtual uint32_t getIncomingDirtyFlags() override;
virtual void clearIncomingDirtyFlags() override;
virtual MotionType computeObjectMotionType() const override;
virtual PhysicsMotionType computePhysicsMotionType() const override;
virtual bool isMoving() const override;

View file

@ -139,7 +139,7 @@ bool EntityMotionState::handleHardAndEasyChanges(uint32_t& flags, PhysicsEngine*
return ObjectMotionState::handleHardAndEasyChanges(flags, engine);
}
MotionType EntityMotionState::computeObjectMotionType() const {
PhysicsMotionType EntityMotionState::computePhysicsMotionType() const {
if (!_entity) {
return MOTION_TYPE_STATIC;
}
@ -157,7 +157,7 @@ bool EntityMotionState::isMoving() const {
// This callback is invoked by the physics simulation in two cases:
// (1) when the RigidBody is first added to the world
// (irregardless of MotionType: STATIC, DYNAMIC, or KINEMATIC)
// (irregardless of PhysicsMotionType: STATIC, DYNAMIC, or KINEMATIC)
// (2) at the beginning of each simulation step for KINEMATIC RigidBody's --
// it is an opportunity for outside code to update the object's simulation position
void EntityMotionState::getWorldTransform(btTransform& worldTrans) const {
@ -608,7 +608,7 @@ glm::vec3 EntityMotionState::getObjectLinearVelocityChange() const {
}
// virtual
void EntityMotionState::setMotionType(MotionType motionType) {
void EntityMotionState::setMotionType(PhysicsMotionType motionType) {
ObjectMotionState::setMotionType(motionType);
resetMeasuredBodyAcceleration();
}
@ -627,7 +627,7 @@ void EntityMotionState::computeCollisionGroupAndMask(int16_t& group, int16_t& ma
if (_entity->getIgnoreForCollisions()) {
group = BULLET_COLLISION_GROUP_COLLISIONLESS;
}
switch (computeObjectMotionType()){
switch (computePhysicsMotionType()){
case MOTION_TYPE_STATIC:
group = BULLET_COLLISION_GROUP_STATIC;
break;

View file

@ -32,8 +32,8 @@ public:
virtual bool handleEasyChanges(uint32_t& flags);
virtual bool handleHardAndEasyChanges(uint32_t& flags, PhysicsEngine* engine);
/// \return MOTION_TYPE_DYNAMIC or MOTION_TYPE_STATIC based on params set in EntityItem
virtual MotionType computeObjectMotionType() const;
/// \return PhysicsMotionType based on params set in EntityItem
virtual PhysicsMotionType computePhysicsMotionType() const;
virtual bool isMoving() const;
@ -94,7 +94,7 @@ protected:
virtual bool isReadyToComputeShape() const override;
virtual btCollisionShape* computeNewShape();
virtual void setMotionType(MotionType motionType);
virtual void setMotionType(PhysicsMotionType motionType);
// In the glorious future (when entities lib depends on physics lib) the EntityMotionState will be
// properly "owned" by the EntityItem and will be deleted by it in the dtor. In pursuit of that

View file

@ -120,7 +120,7 @@ void ObjectMotionState::releaseShape() {
}
}
void ObjectMotionState::setMotionType(MotionType motionType) {
void ObjectMotionState::setMotionType(PhysicsMotionType motionType) {
_motionType = motionType;
}

View file

@ -23,13 +23,13 @@
#include "ContactInfo.h"
#include "ShapeManager.h"
enum MotionType {
enum PhysicsMotionType {
MOTION_TYPE_STATIC, // no motion
MOTION_TYPE_DYNAMIC, // motion according to physical laws
MOTION_TYPE_KINEMATIC // keyframed motion
};
inline QString motionTypeToString(MotionType motionType) {
inline QString motionTypeToString(PhysicsMotionType motionType) {
switch(motionType) {
case MOTION_TYPE_STATIC: return QString("static");
case MOTION_TYPE_DYNAMIC: return QString("dynamic");
@ -88,7 +88,7 @@ public:
virtual void updateBodyMassProperties();
MotionStateType getType() const { return _type; }
virtual MotionType getMotionType() const { return _motionType; }
virtual PhysicsMotionType getMotionType() const { return _motionType; }
void setMass(float mass) { _mass = fabsf(mass); }
float getMass() { return _mass; }
@ -105,7 +105,7 @@ public:
virtual uint32_t getIncomingDirtyFlags() = 0;
virtual void clearIncomingDirtyFlags() = 0;
virtual MotionType computeObjectMotionType() const = 0;
virtual PhysicsMotionType computePhysicsMotionType() const = 0;
btCollisionShape* getShape() const { return _shape; }
btRigidBody* getRigidBody() const { return _body; }
@ -150,13 +150,13 @@ public:
protected:
virtual bool isReadyToComputeShape() const = 0;
virtual btCollisionShape* computeNewShape() = 0;
void setMotionType(MotionType motionType);
void setMotionType(PhysicsMotionType motionType);
void updateCCDConfiguration();
void setRigidBody(btRigidBody* body);
MotionStateType _type = MOTIONSTATE_TYPE_INVALID; // type of MotionState
MotionType _motionType; // type of motion: KINEMATIC, DYNAMIC, or STATIC
PhysicsMotionType _motionType; // type of motion: KINEMATIC, DYNAMIC, or STATIC
btCollisionShape* _shape;
btRigidBody* _body;

View file

@ -98,7 +98,7 @@ void PhysicsEngine::addObjectToDynamicsWorld(ObjectMotionState* motionState) {
float mass = 0.0f;
// NOTE: the body may or may not already exist, depending on whether this corresponds to a reinsertion, or a new insertion.
btRigidBody* body = motionState->getRigidBody();
MotionType motionType = motionState->computeObjectMotionType();
PhysicsMotionType motionType = motionState->computePhysicsMotionType();
motionState->setMotionType(motionType);
switch(motionType) {
case MOTION_TYPE_KINEMATIC: {