mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Merge branch 'master' into inventoryGUI
This commit is contained in:
commit
a284bfb4d0
@ -139,6 +139,8 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|||||||
handleNode(node,0,Ogre::Matrix3::IDENTITY,Ogre::Vector3::ZERO,1,hasCollisionNode,false,true);
|
handleNode(node,0,Ogre::Matrix3::IDENTITY,Ogre::Vector3::ZERO,1,hasCollisionNode,false,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cShape->collide = hasCollisionNode&&cShape->collide;
|
||||||
|
|
||||||
struct TriangleMeshShape : public btBvhTriangleMeshShape
|
struct TriangleMeshShape : public btBvhTriangleMeshShape
|
||||||
{
|
{
|
||||||
TriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression)
|
TriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression)
|
||||||
|
@ -22,7 +22,8 @@ namespace Physic
|
|||||||
COL_NOTHING = 0, //<Collide with nothing
|
COL_NOTHING = 0, //<Collide with nothing
|
||||||
COL_WORLD = BIT(0), //<Collide with world objects
|
COL_WORLD = BIT(0), //<Collide with world objects
|
||||||
COL_ACTOR_INTERNAL = BIT(1), //<Collide internal capsule
|
COL_ACTOR_INTERNAL = BIT(1), //<Collide internal capsule
|
||||||
COL_ACTOR_EXTERNAL = BIT(2) //<collide with external capsule
|
COL_ACTOR_EXTERNAL = BIT(2), //<collide with external capsule
|
||||||
|
COL_RAYCASTING = BIT(3)
|
||||||
};
|
};
|
||||||
|
|
||||||
PhysicActor::PhysicActor(std::string name)
|
PhysicActor::PhysicActor(std::string name)
|
||||||
@ -328,27 +329,31 @@ namespace Physic
|
|||||||
RigidBody* body = new RigidBody(CI,name);
|
RigidBody* body = new RigidBody(CI,name);
|
||||||
body->collide = shape->collide;
|
body->collide = shape->collide;
|
||||||
return body;
|
return body;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicEngine::addRigidBody(RigidBody* body)
|
void PhysicEngine::addRigidBody(RigidBody* body)
|
||||||
{
|
{
|
||||||
if(body->collide)
|
if(body)
|
||||||
{
|
{
|
||||||
dynamicsWorld->addRigidBody(body,COL_WORLD,COL_WORLD|COL_ACTOR_INTERNAL|COL_ACTOR_EXTERNAL);
|
if(body->collide)
|
||||||
}
|
{
|
||||||
else
|
dynamicsWorld->addRigidBody(body,COL_WORLD,COL_WORLD|COL_ACTOR_INTERNAL|COL_ACTOR_EXTERNAL);
|
||||||
{
|
}
|
||||||
dynamicsWorld->addRigidBody(body,COL_WORLD,COL_NOTHING);
|
else
|
||||||
}
|
{
|
||||||
body->setActivationState(DISABLE_DEACTIVATION);
|
dynamicsWorld->addRigidBody(body,COL_RAYCASTING,COL_RAYCASTING|COL_WORLD);
|
||||||
RigidBody* oldBody = RigidBodyMap[body->mName];
|
}
|
||||||
if (oldBody != NULL)
|
body->setActivationState(DISABLE_DEACTIVATION);
|
||||||
{
|
RigidBody* oldBody = RigidBodyMap[body->mName];
|
||||||
dynamicsWorld->removeRigidBody(oldBody);
|
if (oldBody != NULL)
|
||||||
delete oldBody;
|
{
|
||||||
}
|
dynamicsWorld->removeRigidBody(oldBody);
|
||||||
|
delete oldBody;
|
||||||
|
}
|
||||||
|
|
||||||
RigidBodyMap[body->mName] = body;
|
RigidBodyMap[body->mName] = body;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicEngine::removeRigidBody(std::string name)
|
void PhysicEngine::removeRigidBody(std::string name)
|
||||||
@ -460,7 +465,7 @@ namespace Physic
|
|||||||
|
|
||||||
float d1 = 10000.;
|
float d1 = 10000.;
|
||||||
btCollisionWorld::ClosestRayResultCallback resultCallback1(from, to);
|
btCollisionWorld::ClosestRayResultCallback resultCallback1(from, to);
|
||||||
resultCallback1.m_collisionFilterMask = COL_WORLD;
|
resultCallback1.m_collisionFilterMask = COL_WORLD|COL_RAYCASTING;
|
||||||
dynamicsWorld->rayTest(from, to, resultCallback1);
|
dynamicsWorld->rayTest(from, to, resultCallback1);
|
||||||
if (resultCallback1.hasHit())
|
if (resultCallback1.hasHit())
|
||||||
{
|
{
|
||||||
@ -489,7 +494,7 @@ namespace Physic
|
|||||||
std::vector< std::pair<float, std::string> > PhysicEngine::rayTest2(btVector3& from, btVector3& to)
|
std::vector< std::pair<float, std::string> > PhysicEngine::rayTest2(btVector3& from, btVector3& to)
|
||||||
{
|
{
|
||||||
MyRayResultCallback resultCallback1;
|
MyRayResultCallback resultCallback1;
|
||||||
resultCallback1.m_collisionFilterMask = COL_WORLD;
|
resultCallback1.m_collisionFilterMask = COL_WORLD|COL_RAYCASTING;
|
||||||
dynamicsWorld->rayTest(from, to, resultCallback1);
|
dynamicsWorld->rayTest(from, to, resultCallback1);
|
||||||
std::vector< std::pair<float, btCollisionObject*> > results = resultCallback1.results;
|
std::vector< std::pair<float, btCollisionObject*> > results = resultCallback1.results;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user