[Tutorial] Simple rag doll in BGE

Moderators: Yodaman921, Gabriel

[Tutorial] Simple rag doll in BGE

Postby hydra_skillz » Tue Feb 10, 2009 10:24 pm

Start a new scene and go into wire frame mode. Add a plane and scale it up 5 units.

Building the man
Go into front view and select the cube and scale it down .5 units move it up .5 units (z axis) . Duplicate the cube and scale it down to .1 and move it to the side using ctrl so it is locked to the grid (we will use this later). Select our cube and press N to bring up the Transform Properties window and rename it to Right_Foot.
ss1.jpg
ss1.jpg (171.88 KiB) Viewed 12432 times
Now go to the logic panel (F4) and change it from static to rigid body, set the radius to .6, and bounds to box. Now duplicate Right_Foot and move it over 1.2 units (x axis).
ss2.jpg
ss2.jpg (179.72 KiB) Viewed 12434 times
Select both cubes, duplicate them, and move them up 1.2 units (z axis). Add a cube and scale it 1.1 units (x axis) and 1.2 units (z axis) and move it .6 units (x axis) and 3.6 units (z axis). In the logic panel, make it rigid body, radius of 1.2 and box bounds.
ss4.jpg
ss4.jpg (181.19 KiB) Viewed 12431 times
Now duplicate one of the leg cubes (doesn't matter which one) and move it to [-1.2, 0, 4.3] (these are x, y, z world coordinates, you can enter these numbers in the Transform Properties window). Duplicate it again and move it to [-2.4, 0, 4.3], then select both arm pieces, duplicate them, and move them over 4.8 units (x axis). Duplicate one more cube and move it to [.6, 0 , 5.5]. Rename the cubes like in the picture.
ss5.jpg
ss5.jpg (199.41 KiB) Viewed 12431 times


Adding Joints
Select the tiny cube we made in part 1. Go to the logic panel and make it rigid body, .1 radius, and sphere bounds. Using ctrl for grid lock, duplicate and move the cube to these positions.
ss6.jpg
ss6.jpg (262.38 KiB) Viewed 12432 times
Give them sensible names like Right_Knee, Hip, Shoulder, etc. Select the right knee joint and go to the object panel (F7) and click Add Constraint->Rigid Body Joint. Do this twice. In the first constraint, change the field 'toObject' to Right_Leg and in the second to Right_Foot.
ss7.jpg
ss7.jpg (178.69 KiB) Viewed 12433 times
Do this for the left knee. Select one of the hip joints, add two rigid body joint constraints, making the first one Body and second the leg below the hip joint. Do this for the other hip. The shoulders, elbows, and neck are done the same way too. Make the body the first constraint for the neck and shoulders, and the arm for the hands.

When you start the game engine, he should fall over like a rag doll! This concept can be applied to characters by parenting the cubes to the character mesh (like a skeleton) and using vertex groups. Though to make it look good for a detailed character you may need to use more constraints.
GE API <- reference for game engine scripting
User avatar
hydra_skillz
Premium Member
Premium Member
 
Posts: 1321
Joined: Mon Dec 15, 2008 5:22 pm
Location: North Carolina

Re: [Tutorial] Simple rag doll in BGE

Postby llamalizard » Wed Feb 11, 2009 1:15 am

I must try this. finally, a good way of doing dynamic bodies...would it react to a player hitting it? like, realistically, as in seperate parts moving?


also, how would I do this with a makehuman model?
Argh, I be back!
User avatar
llamalizard
Premium Member
Premium Member
 
Posts: 1302
Joined: Thu Aug 28, 2008 5:04 am

Re: [Tutorial] Simple rag doll in BGE

Postby hydra_skillz » Wed Feb 11, 2009 9:16 am

Yes, if you hit one part the others are affected realistically. Try adding a cube, make it dynamic, and add an always force in the direction of the rag doll and aim it at different parts :D. I haven't used this on a detailed character before, but you would need to add constraints to the joints so they won't bend backwards or any way they shouldn't. You can try parenting the armatures to the cubes, so when the cubes fall the armatures go with them and so does the mesh the armatures are affecting.
GE API <- reference for game engine scripting
User avatar
hydra_skillz
Premium Member
Premium Member
 
Posts: 1321
Joined: Mon Dec 15, 2008 5:22 pm
Location: North Carolina

Re: [Tutorial] Simple rag doll in BGE

Postby Moris » Wed Feb 11, 2009 9:37 am

There's a whole lot of fun stuff to see on You Tube. Just do a search for "Blender Ragdoll" and see the fun.
M
Moris
Member
Member
 
Posts: 86
Joined: Wed Sep 10, 2008 12:42 pm

Re: [Tutorial] Simple rag doll in BGE

Postby rewii93 » Sat Jul 04, 2009 6:40 pm

I've searched hours !!! NOTHING REALTIME !!! The only available technic is to bake the animation (its weird) but their is NO REALTIME (in the GE) The constrain don't work well in the GE, I don't know why. And I can't select a bone and a cube, the armature always go back to object mode (???)
rewii93
Member
Member
 
Posts: 644
Joined: Fri Mar 13, 2009 2:16 pm

Re: [Tutorial] Simple rag doll in BGE

Postby hydra_skillz » Sun Jul 05, 2009 9:11 am

You could try something like having the cubes control vertex groups on the character so they would be like the armatures (just rigid).
GE API <- reference for game engine scripting
User avatar
hydra_skillz
Premium Member
Premium Member
 
Posts: 1321
Joined: Mon Dec 15, 2008 5:22 pm
Location: North Carolina


Return to User Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests