From 0bed6d9d56fd89510f8f869044c76757153c47d4 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 21 Jun 2014 23:56:59 +0200 Subject: [PATCH] Physics: Recognize BBoxCollision flag, but don't use it for raycasting (Fixes #1349) --- components/nifbullet/bulletnifloader.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/components/nifbullet/bulletnifloader.cpp b/components/nifbullet/bulletnifloader.cpp index 3e753dd37b..bed3e8869b 100644 --- a/components/nifbullet/bulletnifloader.cpp +++ b/components/nifbullet/bulletnifloader.cpp @@ -137,12 +137,7 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource) handleNode(mesh2, node,0,true,true,false); - if(mBoundingBox != NULL) - { - mShape->mRaycastingShape = mBoundingBox; - delete mesh2; - } - else if (mHasShape) + if (mHasShape) { mShape->mRaycastingShape = new TriangleMeshShape(mesh2,true); } @@ -227,10 +222,12 @@ void ManualBulletShapeLoader::handleNode(btTriangleMesh* mesh, const Nif::Node * if ( (isCollisionNode || (!mShape->mHasCollisionNode && !raycasting)) && (!isMarker || (mShape->mHasCollisionNode && !raycasting))) { + // NOTE: a trishape with hasBounds=true, but no BBoxCollision flag should NOT go through handleNiTriShape! + // It must be ignored completely. + // (occurs in tr_ex_imp_wall_arch_04.nif) if(node->hasBounds) { - // Checking for BBoxCollision flag causes issues with some actors :/ - if (!(node->flags & Nif::NiNode::Flag_Hidden)) + if (flags & Nif::NiNode::Flag_BBoxCollision && !raycasting) { mShape->mBoxTranslation = node->boundPos; mShape->mBoxRotation = node->boundRot;