mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 00:45:36 +00:00
fix markers used for raycasting and blocking activation
This commit is contained in:
parent
234716daa6
commit
4ca0eb93ee
5 changed files with 18 additions and 9 deletions
|
@ -71,7 +71,7 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
||||||
{
|
{
|
||||||
cShape = static_cast<BulletShape *>(resource);
|
cShape = static_cast<BulletShape *>(resource);
|
||||||
resourceName = cShape->getName();
|
resourceName = cShape->getName();
|
||||||
cShape->collide = false;
|
cShape->mCollide = false;
|
||||||
mBoundingBox = NULL;
|
mBoundingBox = NULL;
|
||||||
cShape->boxTranslation = Ogre::Vector3(0,0,0);
|
cShape->boxTranslation = Ogre::Vector3(0,0,0);
|
||||||
cShape->boxRotation = Ogre::Quaternion::IDENTITY;
|
cShape->boxRotation = Ogre::Quaternion::IDENTITY;
|
||||||
|
@ -108,7 +108,7 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
||||||
handleNode(node,0,NULL,hasCollisionNode,false,false);
|
handleNode(node,0,NULL,hasCollisionNode,false,false);
|
||||||
|
|
||||||
//if collide = false, then it does a second pass which create a shape for raycasting.
|
//if collide = false, then it does a second pass which create a shape for raycasting.
|
||||||
if(cShape->collide == false)
|
if(cShape->mCollide == false)
|
||||||
{
|
{
|
||||||
handleNode(node,0,NULL,hasCollisionNode,false,true);
|
handleNode(node,0,NULL,hasCollisionNode,false,true);
|
||||||
}
|
}
|
||||||
|
@ -177,6 +177,7 @@ void ManualBulletShapeLoader::handleNode(Nif::Node *node, int flags,
|
||||||
if (node->name.find("marker") != std::string::npos)
|
if (node->name.find("marker") != std::string::npos)
|
||||||
{
|
{
|
||||||
flags |= 0x800;
|
flags |= 0x800;
|
||||||
|
cShape->mIgnore = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for extra data
|
// Check for extra data
|
||||||
|
@ -254,7 +255,7 @@ void ManualBulletShapeLoader::handleNode(Nif::Node *node, int flags,
|
||||||
}
|
}
|
||||||
else if (node->recType == Nif::RC_NiTriShape && (isCollisionNode || !hasCollisionNode))
|
else if (node->recType == Nif::RC_NiTriShape && (isCollisionNode || !hasCollisionNode))
|
||||||
{
|
{
|
||||||
cShape->collide = !(flags&0x800);
|
cShape->mCollide = !(flags&0x800);
|
||||||
handleNiTriShape(dynamic_cast<Nif::NiTriShape*>(node), flags,node->trafo.rotation,node->trafo.pos,node->trafo.scale,raycastingOnly);
|
handleNiTriShape(dynamic_cast<Nif::NiTriShape*>(node), flags,node->trafo.rotation,node->trafo.pos,node->trafo.scale,raycastingOnly);
|
||||||
}
|
}
|
||||||
else if(node->recType == Nif::RC_RootCollisionNode)
|
else if(node->recType == Nif::RC_RootCollisionNode)
|
||||||
|
|
|
@ -16,7 +16,8 @@ Ogre::Resource(creator, name, handle, group, isManual, loader)
|
||||||
we have none as such. Full details can be set through scripts.
|
we have none as such. Full details can be set through scripts.
|
||||||
*/
|
*/
|
||||||
Shape = NULL;
|
Shape = NULL;
|
||||||
collide = true;
|
mCollide = true;
|
||||||
|
mIgnore = false;
|
||||||
createParamDictionary("BulletShape");
|
createParamDictionary("BulletShape");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,9 @@ public:
|
||||||
Ogre::Vector3 boxTranslation;
|
Ogre::Vector3 boxTranslation;
|
||||||
Ogre::Quaternion boxRotation;
|
Ogre::Quaternion boxRotation;
|
||||||
//this flag indicate if the shape is used for collision or if it's for raycasting only.
|
//this flag indicate if the shape is used for collision or if it's for raycasting only.
|
||||||
bool collide;
|
bool mCollide;
|
||||||
|
|
||||||
|
bool mIgnore;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -169,6 +169,7 @@ namespace Physic
|
||||||
RigidBody::RigidBody(btRigidBody::btRigidBodyConstructionInfo& CI,std::string name)
|
RigidBody::RigidBody(btRigidBody::btRigidBodyConstructionInfo& CI,std::string name)
|
||||||
: btRigidBody(CI)
|
: btRigidBody(CI)
|
||||||
, mName(name)
|
, mName(name)
|
||||||
|
, mIgnore(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +328,7 @@ namespace Physic
|
||||||
|
|
||||||
btRigidBody::btRigidBodyConstructionInfo CI = btRigidBody::btRigidBodyConstructionInfo(0,newMotionState,hfShape);
|
btRigidBody::btRigidBodyConstructionInfo CI = btRigidBody::btRigidBodyConstructionInfo(0,newMotionState,hfShape);
|
||||||
RigidBody* body = new RigidBody(CI,name);
|
RigidBody* body = new RigidBody(CI,name);
|
||||||
body->collide = true;
|
body->mCollide = true;
|
||||||
body->getWorldTransform().setOrigin(btVector3( (x+0.5)*triSize*(sqrtVerts-1), (y+0.5)*triSize*(sqrtVerts-1), (maxh+minh)/2.f));
|
body->getWorldTransform().setOrigin(btVector3( (x+0.5)*triSize*(sqrtVerts-1), (y+0.5)*triSize*(sqrtVerts-1), (maxh+minh)/2.f));
|
||||||
|
|
||||||
HeightField hf;
|
HeightField hf;
|
||||||
|
@ -397,7 +398,8 @@ namespace Physic
|
||||||
//create the real body
|
//create the real body
|
||||||
btRigidBody::btRigidBodyConstructionInfo CI = btRigidBody::btRigidBodyConstructionInfo(0,newMotionState,shape->Shape);
|
btRigidBody::btRigidBodyConstructionInfo CI = btRigidBody::btRigidBodyConstructionInfo(0,newMotionState,shape->Shape);
|
||||||
RigidBody* body = new RigidBody(CI,name);
|
RigidBody* body = new RigidBody(CI,name);
|
||||||
body->collide = shape->collide;
|
body->mCollide = shape->mCollide;
|
||||||
|
body->mIgnore = shape->mIgnore;
|
||||||
|
|
||||||
if(scaledBoxTranslation != 0)
|
if(scaledBoxTranslation != 0)
|
||||||
*scaledBoxTranslation = shape->boxTranslation * scale;
|
*scaledBoxTranslation = shape->boxTranslation * scale;
|
||||||
|
@ -414,7 +416,9 @@ namespace Physic
|
||||||
{
|
{
|
||||||
if(body)
|
if(body)
|
||||||
{
|
{
|
||||||
if(body->collide)
|
if (body->mIgnore)
|
||||||
|
return;
|
||||||
|
if(body->mCollide)
|
||||||
{
|
{
|
||||||
dynamicsWorld->addRigidBody(body,COL_WORLD,COL_WORLD|COL_ACTOR_INTERNAL|COL_ACTOR_EXTERNAL);
|
dynamicsWorld->addRigidBody(body,COL_WORLD,COL_WORLD|COL_ACTOR_INTERNAL|COL_ACTOR_EXTERNAL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,8 @@ namespace Physic
|
||||||
std::string mName;
|
std::string mName;
|
||||||
|
|
||||||
//is this body used for raycasting only?
|
//is this body used for raycasting only?
|
||||||
bool collide;
|
bool mCollide;
|
||||||
|
bool mIgnore;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HeightField
|
struct HeightField
|
||||||
|
|
Loading…
Reference in a new issue