fix markers used for raycasting and blocking activation

actorid
scrawl 12 years ago
parent 234716daa6
commit 4ca0eb93ee

@ -71,7 +71,7 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
{
cShape = static_cast<BulletShape *>(resource);
resourceName = cShape->getName();
cShape->collide = false;
cShape->mCollide = false;
mBoundingBox = NULL;
cShape->boxTranslation = Ogre::Vector3(0,0,0);
cShape->boxRotation = Ogre::Quaternion::IDENTITY;
@ -108,7 +108,7 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
handleNode(node,0,NULL,hasCollisionNode,false,false);
//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);
}
@ -177,6 +177,7 @@ void ManualBulletShapeLoader::handleNode(Nif::Node *node, int flags,
if (node->name.find("marker") != std::string::npos)
{
flags |= 0x800;
cShape->mIgnore = true;
}
// 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))
{
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);
}
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.
*/
Shape = NULL;
collide = true;
mCollide = true;
mIgnore = false;
createParamDictionary("BulletShape");
}

@ -34,7 +34,9 @@ public:
Ogre::Vector3 boxTranslation;
Ogre::Quaternion boxRotation;
//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)
: btRigidBody(CI)
, mName(name)
, mIgnore(false)
{
}
@ -327,7 +328,7 @@ namespace Physic
btRigidBody::btRigidBodyConstructionInfo CI = btRigidBody::btRigidBodyConstructionInfo(0,newMotionState,hfShape);
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));
HeightField hf;
@ -397,7 +398,8 @@ namespace Physic
//create the real body
btRigidBody::btRigidBodyConstructionInfo CI = btRigidBody::btRigidBodyConstructionInfo(0,newMotionState,shape->Shape);
RigidBody* body = new RigidBody(CI,name);
body->collide = shape->collide;
body->mCollide = shape->mCollide;
body->mIgnore = shape->mIgnore;
if(scaledBoxTranslation != 0)
*scaledBoxTranslation = shape->boxTranslation * scale;
@ -414,7 +416,9 @@ namespace Physic
{
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);
}

@ -152,7 +152,8 @@ namespace Physic
std::string mName;
//is this body used for raycasting only?
bool collide;
bool mCollide;
bool mIgnore;
};
struct HeightField

Loading…
Cancel
Save