1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-29 18:32:36 +00:00

BulletNifLoader: Handle only the first child of NiSwitchNode and NiFltAnimationNode

To prevent duplicated collisions in general cases when the node states are similar or only one child is ever active.
For NiLODNode this is definitely not going to work
This commit is contained in:
Alexei Kotov 2023-12-03 17:44:49 +03:00
parent 53f5e4dd3c
commit 6e7661ca87

View File

@ -250,11 +250,16 @@ namespace NifBullet
const Nif::Parent currentParent{ *ninode, parent };
for (const auto& child : ninode->mChildren)
{
if (child.empty())
continue;
assert(std::find(child->mParents.begin(), child->mParents.end(), ninode) != child->mParents.end());
handleNode(child.get(), &currentParent, args);
if (!child.empty())
{
assert(std::find(child->mParents.begin(), child->mParents.end(), ninode) != child->mParents.end());
handleNode(child.get(), &currentParent, args);
}
// For NiSwitchNodes and NiFltAnimationNodes, only use the first child
// TODO: must synchronize with the rendering scene graph somehow
// Doing this for NiLODNodes is unsafe (the first level might not be the closest)
if (node.recType == Nif::RC_NiSwitchNode || node.recType == Nif::RC_NiFltAnimationNode)
break;
}
}
}