Flipped ragdolls

Hey again.

Alright, so basically, I copied the biped stuff from the testbed and got it all working fine and dandy.
But, I want to make a "flipped" biped, to use as a second player aiming in another direction..

I made a class inherit biped, blah blah, virtual functions, the whole bit.. now, how I went with the flipping was basically anything that had to do with the x axis I flipped (if it was - I removed it, if it wasn't I added one)..

Now, it seems to render fine, except for two things:
* The chest seems to be missing
* The entire body, except head, is green

What does green mean? What have I not taken into account?
There's a huge amount of code so I can't really paste it here..
Any ideas?

-P
Static bodies are drawn in green. To make the body dynamic, make sure one of the fixtures/shapes has non-zero density and that you call b2Body::SetMassFromShapes.
Ah, thanks, I'll double-check that nothing bad happened.

By the way.. I made a quick dynamic-joint system that lets you grab objects with your hands as a ragdoll and toss them, but when I have it enabled so that you can grab static objects, the ragdoll explodes ("bad things happen", as your doc states).. however I copied the code directly below it, and it still explodes my ragdoll.. Any ideas?

Here's how I make the jointDef:
Code:
            Ragdoll->Grabbing = true;
            b2RevoluteJointDef jointDef;
            jointDef.Initialize(Body1, Body2, Body1->GetWorldCenter());
            jointDef.lowerAngle = -0.5f * b2_pi; // -90 degrees
            jointDef.upperAngle = 0.25f * b2_pi; // 45 degrees
            jointDef.enableLimit = true;
            jointDef.maxMotorTorque = 10.0f;
            jointDef.motorSpeed = 0.0f;
            jointDef.enableMotor = true;
            Ragdoll->GrabJointDef = jointDef;
            Ragdoll->GrabJoint = NULL;
            // Set to: = (b2RevoluteJoint*)world->CreateJoint(&jointDef);
            // after the callback.


-P
The joint def looks fine. Can you create a small testbed example that recreates the bad behavior?
Paril wrote:
What does green mean? What have I not taken into account?

Box2d requires vertex order to be consistent, the green probably means that you forgot to reverse the order of vertices when you flipped the polygons over and they're being treated as static.

You'll also probably need to change some of the joint limits to account for the flipped geometry, too.
Ahh, vertex order, that's what I forgot! I'll mess with it in a sec.

You can see the testbed here:
http://www.alteredsoftworks.com/Release.rar

Controls:
Up/down/left/right arrows: Control ragdoll 1 from chest
z: Grab object from hands on ragdoll 1

w/s/a/d: Control ragdoll 2 from chest
g: grab object from hands on ragdoll 2

1: Spawn a bunch of random boxes
2: Explode everything
3: Spawn some shells
4: Delete all boxes
5: Slow motion
6: Stops all boxes from moving (sleeps then wakes up)

EDIT: I got the flipped dude to actually render and act correctly, only problem now is the joints.
Which one am I changing, lower or upper limit, or both?

-P
Oop, uploaded to the wrong dir.
Link is active now.

-P

Original thread: https://box2d.org/forum/viewtopic.php?t=3479