diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index 784910d51..15cb39fb1 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -557,6 +557,11 @@ namespace MWPhysics return mCollisionObject.get(); } + const btCollisionObject* getCollisionObject() const + { + return mCollisionObject.get(); + } + /// Return solid flag. Not used by the object itself, true by default. bool isSolid() const { @@ -883,6 +888,12 @@ namespace MWPhysics const Actor* actor = getActor(ignore); if (actor) me = actor->getCollisionObject(); + else + { + const Object* object = getObject(ignore); + if (object) + me = object->getCollisionObject(); + } } ClosestNotMeRayResultCallback resultCallback(me, btFrom, btTo); @@ -1174,6 +1185,14 @@ namespace MWPhysics return NULL; } + const Object* PhysicsSystem::getObject(const MWWorld::ConstPtr &ptr) const + { + ObjectMap::const_iterator found = mObjects.find(ptr); + if (found != mObjects.end()) + return found->second; + return NULL; + } + void PhysicsSystem::updateScale(const MWWorld::Ptr &ptr) { ObjectMap::iterator found = mObjects.find(ptr); diff --git a/apps/openmw/mwphysics/physicssystem.hpp b/apps/openmw/mwphysics/physicssystem.hpp index 62ebf4f0e..c12672285 100644 --- a/apps/openmw/mwphysics/physicssystem.hpp +++ b/apps/openmw/mwphysics/physicssystem.hpp @@ -70,6 +70,8 @@ namespace MWPhysics Actor* getActor(const MWWorld::Ptr& ptr); const Actor* getActor(const MWWorld::ConstPtr& ptr) const; + const Object* getObject(const MWWorld::ConstPtr& ptr) const; + // Object or Actor void remove (const MWWorld::Ptr& ptr);