mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 06:44:06 +02:00
stubbery for alerting entity that shape changed
This commit is contained in:
parent
1ed76ae442
commit
b2dfa49a6f
5 changed files with 22 additions and 4 deletions
|
@ -61,6 +61,8 @@ public:
|
|||
virtual bool isReadyToComputeShape() override;
|
||||
virtual void computeShapeInfo(ShapeInfo& info) override;
|
||||
|
||||
void setCollisionShape(const btCollisionShape* shape) override {}
|
||||
|
||||
virtual bool contains(const glm::vec3& point) const override;
|
||||
|
||||
virtual bool shouldBePhysical() const override;
|
||||
|
|
|
@ -44,6 +44,7 @@ class EntityTreeElementExtraEncodeData;
|
|||
class EntityActionInterface;
|
||||
class EntityItemProperties;
|
||||
class EntityTree;
|
||||
class btCollisionShape;
|
||||
typedef std::shared_ptr<EntityTree> EntityTreePointer;
|
||||
typedef std::shared_ptr<EntityActionInterface> EntityActionPointer;
|
||||
typedef std::shared_ptr<EntityTreeElement> EntityTreeElementPointer;
|
||||
|
@ -324,6 +325,12 @@ public:
|
|||
/// return preferred shape type (actual physical shape may differ)
|
||||
virtual ShapeType getShapeType() const { return SHAPE_TYPE_NONE; }
|
||||
|
||||
virtual void setCollisionShape(const btCollisionShape* shape) {}
|
||||
|
||||
// these are only needed because the names don't match
|
||||
virtual const glm::quat getRotation() const { return getOrientation(); }
|
||||
virtual void setRotation(glm::quat orientation) { setOrientation(orientation); }
|
||||
|
||||
// updateFoo() methods to be used when changes need to be accumulated in the _dirtyFlags
|
||||
virtual void updateRegistrationPoint(const glm::vec3& value);
|
||||
void updatePosition(const glm::vec3& value);
|
||||
|
|
|
@ -271,6 +271,14 @@ btCollisionShape* EntityMotionState::computeNewShape() {
|
|||
return getShapeManager()->getShape(shapeInfo);
|
||||
}
|
||||
|
||||
void EntityMotionState::setShape(btCollisionShape* shape) {
|
||||
bool shapeChanged = (_shape != shape);
|
||||
ObjectMotionState::setShape(shape);
|
||||
if (shapeChanged) {
|
||||
_entity->setCollisionShape(_shape);
|
||||
}
|
||||
}
|
||||
|
||||
bool EntityMotionState::isCandidateForOwnership() const {
|
||||
assert(_body);
|
||||
assert(_entity);
|
||||
|
|
|
@ -88,9 +88,10 @@ protected:
|
|||
bool entityTreeIsLocked() const;
|
||||
#endif
|
||||
|
||||
virtual bool isReadyToComputeShape() const override;
|
||||
virtual btCollisionShape* computeNewShape() override;
|
||||
virtual void setMotionType(PhysicsMotionType motionType);
|
||||
bool isReadyToComputeShape() const override;
|
||||
btCollisionShape* computeNewShape() override;
|
||||
void setShape(btCollisionShape* shape) override;
|
||||
void setMotionType(PhysicsMotionType motionType) override;
|
||||
|
||||
// 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
|
||||
|
|
|
@ -151,7 +151,7 @@ public:
|
|||
protected:
|
||||
virtual bool isReadyToComputeShape() const = 0;
|
||||
virtual btCollisionShape* computeNewShape() = 0;
|
||||
void setMotionType(PhysicsMotionType motionType);
|
||||
virtual void setMotionType(PhysicsMotionType motionType);
|
||||
void updateCCDConfiguration();
|
||||
|
||||
void setRigidBody(btRigidBody* body);
|
||||
|
|
Loading…
Reference in a new issue