shanefarris
28-01-2010 14:55:45
I have a more complex model I am applying a ragdoll to right now and kept getting "bNormalizationresult" failure every time the demo would start. After spending some time on this I saw in the createBoneBody method it iterates through every bone on the model, even bones that are not specified in the ogreode xml file. For the zombie model it would fine a few bones that where not in the xml file and not return a gemo type.
"CapsuleGeometry *geom = _ei->createOrientedCapsule(bone->getHandle(), _world, _space);" would return a NULL with the zombie and all would be well because "physical_bone" would be NULL too.
But with my model "_ei->createOrientedCapsule(bone->getHandle(), _world, _space);" would produce a gemo even if it is using "_default_bone_settings".
"_default_bone_settings" is only used when you run across a bone that is not specified in the xml file. In that case I think we are expecting to not get a value for "gemo".
Back to my model...My model is returning a value for gemo, I don't know why yet, and I'm still looking into this, but if I add this code before we look for the bone setting:
It will load my ragdoll without erring out. NOTE the ragdoll is not working correctly yet, but I believe this to be because I am still prototyping it, and haven't had much time to continue working on it yet.
Do we have a bug, or do I know understand enough of the code yet? My "fix" shouldn't be a patch, it's just a hack to get it working.
Thoughts?
std::map<String,Ragdoll::BoneSettings>::iterator i = _bone_settings.find(bone->getName());
Ragdoll::BoneSettings settings = (i != _bone_settings.end())? i->second : _default_bone_settings;
Ragdoll::PhysicalBone *physical_bone = 0;
// Create an oriented capsule
if (settings._geometry_class == Geometry::Class_Capsule)
{
// Create the geometry
CapsuleGeometry *geom = _ei->createOrientedCapsule(bone->getHandle(), _world, _space);
if (geom)
"CapsuleGeometry *geom = _ei->createOrientedCapsule(bone->getHandle(), _world, _space);" would return a NULL with the zombie and all would be well because "physical_bone" would be NULL too.
But with my model "_ei->createOrientedCapsule(bone->getHandle(), _world, _space);" would produce a gemo even if it is using "_default_bone_settings".
"_default_bone_settings" is only used when you run across a bone that is not specified in the xml file. In that case I think we are expecting to not get a value for "gemo".
Back to my model...My model is returning a value for gemo, I don't know why yet, and I'm still looking into this, but if I add this code before we look for the bone setting:
if(_bone_settings.find(bone->getName()) == _bone_settings.end())
{
Node::ChildNodeIterator cni = bone->getChildIterator();
while(cni.hasMoreElements())
{
createBoneBody((Bone*)cni.getNext(), parent, static_geometry);
}
return;
}
It will load my ragdoll without erring out. NOTE the ragdoll is not working correctly yet, but I believe this to be because I am still prototyping it, and haven't had much time to continue working on it yet.
Do we have a bug, or do I know understand enough of the code yet? My "fix" shouldn't be a patch, it's just a hack to get it working.
Thoughts?