Bug in OgreOdeRagdoll?

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.

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?

tuan kuranes

28-01-2010 17:06:51

Doesnt that handle when you doesn't map a bone inside a hierarchy in your xml but you does map its children ?

shanefarris

28-01-2010 18:34:49

Not sure if I understand what you're saying, but if you're talking about :

_ei->createOrientedCapsule(bone->getHandle(), _world, _space);


Then I think it will return a NULL if there are no children, but if you pass it a bone handle that has not been set in the xml, but has children attached to that bone, it will return a value.

Are we on the same page?

tuan kuranes

01-02-2010 13:50:47

yes, then it's ok

shanefarris

01-02-2010 14:07:13

So what do I need to do then? Because I am getting a gemo returned on a default bone. A default bone is used when there's a bone in the model but not used in the ragdoll setup. This will lead to a "bNormalizationreault" error during the first render cycle. To fix this I added the code above, but going through it this weekend I see this code is not fixing much because my rigid body's are twice the size they need to be on some bones, normal size on some other bones.

tuan kuranes

01-02-2010 14:39:56

rigid body's are twice the size they need to be on some bones, normal size on some other bones.
Are you scaling it ?

Did you try with a nearly empty ogreode first (like ninja.ogreode file)

shanefarris

01-02-2010 23:32:19

Yeah I'm basing the ogreode file off of the zombie file.

I'm not scaling the model, I noticed that it will mess with the rigid bodies.

tuan kuranes

02-02-2010 07:05:59

Not the zombie file, unless it's the "auto" file, I really mean a near empty file just defining the default behaviour for bones.

shanefarris

02-02-2010 14:54:14

I did that last night, I only defined the default, and when I shoot my character he doesn't fall down but goes back to the original pose. I then added the root, and he does fall, but the root is bigger then it needs to be. If the root bone is contained in a capsule it is basically a sphere that extends out past his stomach. So I changed it to a box which fits closer to his shape but I think it is still too big for him.

The container geom for the upper right leg is very big, and even goes up past the root, and is twice as wide as it should be. The left leg looks about right. The feet are chopped off in have, but I think its because the vertices are not setup correctly somehow, I have having a artist look at it.

I had to rescale it to .04 its original size, so I'm wondering if meshmagic didn't mess the bones up some how. I am looking into it now. But I can send you a pic of what my ragdoll looks like, but not sure how I can show an image.

tuan kuranes

02-02-2010 15:16:29

Hard to say from here. perhaps a pic will help otherwise if you can send a mesh/skeleton file I can have a look.

shanefarris

03-02-2010 13:18:01

In this first image you can see the right thigh is very wide, and very long, it goes up past the pelvis. The pelvis by the way is a box because if its a capsule is basically is just a large sphere that makes half the mesh roll around on.



The feet I am having an artist take a look at, I think there's something wrong with the vertices, or maybe the bone on the feet don't extend to the entire foot, does it need to?



This is just another side of the ragdoll. I've been trying different shapes to get it to look kind of normal, but the left thigh you can see is put in the pelvis too.

I resized the model using meshmagic to .04 of its original size, so maybe that had something to do with it. I am having an artist resize it in max, then I'll export it and see how it goes, but any idea why this would mess up like this so much?

tuan kuranes

03-02-2010 13:56:36

resize may be the problem.
Otherwise no idea why it goes like that, unless there's a bug somewhere...