Rag Doll TestBed

Tell us about your game or application that uses Box2D.
Posts: 241
Joined: Fri Dec 07, 2007 3:09 pm

Rag Doll TestBed

Postby darkzerox » Mon Dec 17, 2007 2:32 pm

I decided to zip the whole package in case anyone had trouble compiling.

- RagDoll.h
- Biped.cpp
- Biped.h
- BipedDef.cpp
- BipedDef.h

- VC8 solution and project files
- TestEntries.cpp

Available for download here: http://www.sfu.ca/~mnb2/Box2D.zip

To create a new biped (ragdoll) only requires two lines of code:

BipedDef bd;
Biped(m_world,&bd); // creates a new biped at (0,0) in m_world

You may want to keep a reference to your biped object so that you can modify its parameters later:

Biped bip* = new Biped(m_world, &bd);

Don't forget to delete it.

You can modify all the body parts at once by making these calls to BipedDef:

void SetMotorTorque(float);
void SetMotorSpeed(float);
void SetDensity(float);
void SetFriction(float);
void SetRestitution(float);
void SetLinearDamping(float);
void SetAngularDamping(float);
void EnableLimit();
void DisableLimit();
void SetLimit(bool);
void EnableMotor();
void DisableMotor();
void SetMotor(bool);
void SetGroupIndex(int16);
void SetPosition(float, float);
void SetPosition(b2Vec2);
void IsFast(bool); // this function has been commented out for earlier versions of Box2D

Also for your convenience (in Biped) are:

float GetMass(); // get the mass of the entire Biped (default is about 60 kg = 130 density)
b2Vec2 GetCenterPosition(); // get the center position of the entire biped

Or you can modify them individually by calling

bd.<BodyPart>Def to modify the body definitions
bd.<BodyPart>Poly to modify the poly definitions, with the exception of Head, which is HeadCirc
bd.<Joint>Def to modify the joint definitions

Body parts: LFoot, RFoot, LCalf, RCalf, LThigh, RThigh, Pelvis, Stomach, Chest, Neck, Head, LUpperArm, RUpperArm, LForearm, RForearm, LHand, RHand

Joints: LAnkle, RAnkle, LKnee, RKnee, LHip, RHip, LowerAbs, UpperAbs, LowerNeck, UpperNeck, LShoulder, RShoulder, LElbow, RElbow, LWrist, RWrist

Questions, comments and critique are welcome. Let me know if I have any memory leaks, that's not really my specialty.

Also, I would much appreciate anyone's help trying to get one of these things walking on their own.

Erin Catto
Site Admin
Posts: 2948
Joined: Thu Sep 06, 2007 12:34 am

Re: Rag Doll TestBed

Postby Erin Catto » Mon Dec 17, 2007 10:55 pm

Thanks! I'll put this into 2.0.

Erin Catto
Site Admin
Posts: 2948
Joined: Thu Sep 06, 2007 12:34 am

Re: Rag Doll TestBed

Postby Erin Catto » Mon Jan 28, 2008 1:28 am

This is in SVN now. I made an interesting test case with this. :)

Thanks again!

Posts: 155
Joined: Tue Sep 18, 2007 6:17 am
Location: Western Cape, South Africa

Re: Rag Doll TestBed

Postby Wahooney » Mon Jan 28, 2008 1:16 pm

Ragdoll Bomb? ;)

Posts: 1
Joined: Wed May 11, 2011 7:36 am

Re: Rag Doll TestBed

Postby gotohamed » Wed May 11, 2011 7:39 am

The requested URL /~mnb2/Box2D.zip was not found on this server. :( any help??? :(

Return to “Games and Applications”

Who is online

Users browsing this forum: No registered users and 2 guests