RigDoll Tutorial V1

This is not perfect, as I have only made 2 RigDolls from scratch now :smiley: (this is #2) based on the original rigdoll by Jackii

Part 1 - The Action armature and the rigdoll

1 - Armature needs ‘Bone tags’ to be placed, and then orientated to match local bone orientation. then parented to that bone.

2 - Ragdoll bone is placed at bone location and match bone orientation

3 - property ‘RagTag’ =Name of Bone tag for that RagBone.

4 - the script =


import bge
from mathutils import Vector


def main():


    cont = bge.logic.getCurrentController()
    own = cont.owner


    if 'Parts' not in own:
        ##Looks up RagBones using string, then stores RagTag in RagBone.
        Parts=['NameOfBone1','NameOfBone2']
        L2 =[]
        for part in Parts:
            L2.append(bge.logic.getCurrentScene().objects[part])
        for part in L2:    
            part['RagTag'] = bge.logic.getCurrentScene().objects[str(part['RagTag'])]
        own['Parts']=L2    
    else:
        ## Loops through RagBones and compares orientation and produces a AngV using momentum and dampening
        for parts in own['Parts']:
            print(parts.name)
            stren= parts['strength']           
            dif = Vector((parts['RagTag'].worldOrientation * parts.worldOrientation.inverted()).to_euler())
            mag = dif.magnitude
            vel = dif * stren * (1*30)*mag
            angV=parts.worldAngularVelocity.copy()
            parts.worldAngularVelocity = ((angV)+vel)*.3
            
             


main()



Thanks! I will learn up from this as soon as I can!:slight_smile:

When is part 2 coming out?

walking? I can try tonight, I have been having alot of fun with Non Juggernaut lately.

Nice! BTW, would you have time to help me make the RigDoll, because I am not suceeding with part 1 even:D

do you have a character and armature?

you can grab my walking demo rig if you want

then place the ragtags, and align them the bones orientation, and parent then to each bone, name them something like BoneNameRagtag like RightFemurRagtag

once you have a tagged armature let me know, I’ll look it over if you get stuck.
then you need to make a ragdoll,
each ragbone is a rigid body object, connected to the next ragBone up the chain using a rigid body jointjoint 6dof

example

forearm is connected to the upper arm,

which is connected to the chest. which hooks to upper torso which hooks to torso

head connects to neck, which connects to chest

then later, you add each bone to the code (the part list)

I got it, however, the rigs sometime don’t act correctly. And what about torso and chest - should they be RB with joints or static?

all bones should be represented with ragbones, or the actor will not respond the same as the ik rig.

So I should make a full ragdoll(including fingers and jaw etc.) using your shown method(with ragtags)? Yeah, I have fingers- may that be a problem?

yeah, for physics per ragdoll they will be quite high,
simple is better for this.

But I need to animate the hands somehow. What to do?

the graphics armature can have fingers

the action armature can start with them, but the fingers don’t need bone tags

after you copy the action armature later to make the graphics armature, you can delete the fingers from the action rig.

(so hands will be animated but not with 100% physical realness.)

And I can animate them in graphics armature seperately? So I get the fingers non-physics but everything else physicsful? I hope that the fact that my character is 2 BU high doesn;t metter(it is very small size).

Do you know a way to get bone’s workd orientation in editor? For some reason that option doesn’t exist in “n” button section!

size does not matter, I align the bones by hand, just turn on local orientation view (so you can see which way they are facing) this also means it would be a good idea for the actor to start in a ‘T’ pose

1 = build a rig

2 = add bone tags and align and parent

3 = make ragbones for all bone that will be phyisical (matcjh orientation)

4 = rigid body joint all ragbones (think IK parent of IK bone) add ‘strength’ to each bone

5= add all bones to script ‘bone list’

press play

Um… Makehuman gave me non-T shaped hand positioning, that’s a problem…:frowning: I will try to align anyway.

That’s fine, T pose just makes it easier, and it does not have to be perfect, just VERY CLOSE.

if the RagTags are misaligned, then the RagBones will be misaligned to ik bones,

if the RagBones start misaligned they will ‘Snap’ into orientation of the ragtags on frame 1

Here is the walk cycle demo raggified

Note * No graphics armature, GFX skin is using action armature

Note * no step force filters , this is all friction

Attachments

RagWalkPart2TheWalk.blend (633 KB)

Ok, and here it is working, after some amount of tinkering,

if you see own[‘Parts’][number]

that is using the original spot of the bone in the list,

I should replace those with

RightArm = own[‘Parts’][index]

etc

WAD (no backward yet)

also, the feet property[‘Contact’] = the object your stepping on.

Attachments

RagWalkPart3TheWalk.blend (712 KB)