Only build a box shape for collision nodes; use StringUtils

actorid
scrawl 12 years ago
parent d7c4a622cf
commit 14964e9fcd

@ -25,7 +25,8 @@ http://www.gnu.org/licenses/ .
#include <cstdio> #include <cstdio>
#include <boost/algorithm/string.hpp>
#include <components/misc/stringops.hpp>
#include "../nif/niffile.hpp" #include "../nif/niffile.hpp"
#include "../nif/node.hpp" #include "../nif/node.hpp"
@ -188,7 +189,7 @@ void ManualBulletShapeLoader::handleNode(btTriangleMesh* mesh, const Nif::Node *
// Marker objects: no collision // Marker objects: no collision
/// \todo don't do this in the editor /// \todo don't do this in the editor
std::string nodename = node->name; std::string nodename = node->name;
boost::algorithm::to_lower(nodename); Misc::StringUtils::toLower(nodename);
if (nodename.find("marker") != std::string::npos) if (nodename.find("marker") != std::string::npos)
{ {
return; return;
@ -222,16 +223,19 @@ void ManualBulletShapeLoader::handleNode(btTriangleMesh* mesh, const Nif::Node *
} }
} }
if(node->hasBounds) if (isCollisionNode || (!hasCollisionNode && !raycasting))
{
cShape->mBoxTranslation = node->boundPos;
cShape->mBoxRotation = node->boundRot;
mBoundingBox = new btBoxShape(getbtVector(node->boundXYZ));
}
else if( (isCollisionNode || (!hasCollisionNode && !raycasting)) && node->recType == Nif::RC_NiTriShape)
{ {
cShape->mCollide = !(flags&0x800); if(node->hasBounds)
handleNiTriShape(mesh, static_cast<const Nif::NiTriShape*>(node), flags, node->getWorldTransform(), raycasting); {
cShape->mBoxTranslation = node->boundPos;
cShape->mBoxRotation = node->boundRot;
mBoundingBox = new btBoxShape(getbtVector(node->boundXYZ));
}
else if(node->recType == Nif::RC_NiTriShape)
{
cShape->mCollide = !(flags&0x800);
handleNiTriShape(mesh, static_cast<const Nif::NiTriShape*>(node), flags, node->getWorldTransform(), raycasting);
}
} }
// For NiNodes, loop through children // For NiNodes, loop through children

Loading…
Cancel
Save