From 4cedf0fbab922fa81da75a689853100a9a5fbc6d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 28 Apr 2013 11:12:55 -0700 Subject: [PATCH] Avoid colliding with AvoidNodes These are placed under the RootCollisionNode hierarchy, but the shapes they hold aren't collided with. Their exact function is unknown, but seems to be related to lava? Maybe damage avoidance info for the AI. --- components/nif/niffile.cpp | 2 +- components/nif/record.hpp | 1 + components/nifbullet/bulletnifloader.cpp | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/components/nif/niffile.cpp b/components/nif/niffile.cpp index a66bd99db5..cb7c2feb07 100644 --- a/components/nif/niffile.cpp +++ b/components/nif/niffile.cpp @@ -207,7 +207,7 @@ struct RecordFactoryEntry { static const RecordFactoryEntry recordFactories [] = { { "NiNode", &construct , RC_NiNode }, - { "AvoidNode", &construct , RC_NiNode }, + { "AvoidNode", &construct , RC_AvoidNode }, { "NiBSParticleNode", &construct , RC_NiBSParticleNode }, { "NiBSAnimationNode", &construct , RC_NiBSAnimationNode }, { "NiBillboardNode", &construct , RC_NiNode }, diff --git a/components/nif/record.hpp b/components/nif/record.hpp index 3f852ed837..87e342dca5 100644 --- a/components/nif/record.hpp +++ b/components/nif/record.hpp @@ -36,6 +36,7 @@ enum RecordType { RC_MISSING = 0, RC_NiNode, + RC_AvoidNode, RC_NiTriShape, RC_NiRotatingParticles, RC_NiAutoNormalParticles, diff --git a/components/nifbullet/bulletnifloader.cpp b/components/nifbullet/bulletnifloader.cpp index a3eff95c3e..a1e2cd8d18 100644 --- a/components/nifbullet/bulletnifloader.cpp +++ b/components/nifbullet/bulletnifloader.cpp @@ -185,6 +185,10 @@ void ManualBulletShapeLoader::handleNode(btTriangleMesh* mesh, const Nif::Node * else isCollisionNode = isCollisionNode && (node->recType != Nif::RC_RootCollisionNode); + // Don't collide with AvoidNode shapes + if(node->recType == Nif::RC_AvoidNode) + flags |= 0x800; + // Marker objects /// \todo don't do this in the editor std::string nodename = node->name;