mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 06:44:06 +02:00
move API from PhysicsEngine to ObjectMotionState
This commit is contained in:
parent
8e61a10bcf
commit
b0ca2df3aa
5 changed files with 5 additions and 39 deletions
|
@ -80,7 +80,8 @@ void RenderableDebugableEntityItem::render(EntityItem* entity, RenderArgs* args)
|
|||
renderBoundingBox(entity, args, 0.3f, yellowColor);
|
||||
}
|
||||
|
||||
if (PhysicsEngine::physicsInfoIsActive(entity->getPhysicsInfo())) {
|
||||
ObjectMotionState* motionState = static_cast<ObjectMotionState*>(entity->getPhysicsInfo());
|
||||
if (motionState && motionState->isActive()) {
|
||||
renderHoverDot(entity, args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,3 +200,4 @@ void ObjectMotionState::updateBodyMassProperties() {
|
|||
_body->setMassProps(mass, inertia);
|
||||
_body->updateInertiaTensor();
|
||||
}
|
||||
|
||||
|
|
|
@ -125,6 +125,8 @@ public:
|
|||
|
||||
virtual int16_t computeCollisionGroup() = 0;
|
||||
|
||||
bool isActive() const { return _body ? _body->isActive() : false; }
|
||||
|
||||
friend class PhysicsEngine;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -431,40 +431,6 @@ void PhysicsEngine::setCharacterController(DynamicCharacterController* character
|
|||
}
|
||||
}
|
||||
|
||||
// static
|
||||
bool PhysicsEngine::physicsInfoIsActive(void* physicsInfo) {
|
||||
if (!physicsInfo) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ObjectMotionState* motionState = static_cast<ObjectMotionState*>(physicsInfo);
|
||||
btRigidBody* body = motionState->getRigidBody();
|
||||
if (!body) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return body->isActive();
|
||||
}
|
||||
|
||||
// static
|
||||
bool PhysicsEngine::getBodyLocation(void* physicsInfo, glm::vec3& positionReturn, glm::quat& rotationReturn) {
|
||||
if (!physicsInfo) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ObjectMotionState* motionState = static_cast<ObjectMotionState*>(physicsInfo);
|
||||
btRigidBody* body = motionState->getRigidBody();
|
||||
if (!body) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const btTransform& worldTrans = body->getCenterOfMassTransform();
|
||||
positionReturn = bulletToGLM(worldTrans.getOrigin()) + ObjectMotionState::getWorldOffset();
|
||||
rotationReturn = bulletToGLM(worldTrans.getRotation());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int16_t PhysicsEngine::getCollisionMask(int16_t group) const {
|
||||
const int16_t* mask = _collisionMasks.find(btHashInt((int)group));
|
||||
return mask ? *mask : COLLISION_MASK_DEFAULT;
|
||||
|
|
|
@ -91,10 +91,6 @@ public:
|
|||
|
||||
void dumpNextStats() { _dumpNextStats = true; }
|
||||
|
||||
// TODO: Andrew to move these to ObjectMotionState
|
||||
static bool physicsInfoIsActive(void* physicsInfo);
|
||||
static bool getBodyLocation(void* physicsInfo, glm::vec3& positionReturn, glm::quat& rotationReturn);
|
||||
|
||||
int16_t getCollisionMask(int16_t group) const;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue