Page 1 of 1

Realistic momentum transferring in walking ragdoll,

Posted: Sat May 03, 2014 5:19 pm
by BluePrintRandom

Code: Select all

import bge


## this code sends linV to the pelvis and back each frame from every rigid body piece
def main():


cont = bge.logic.getCurrentController()
own = cont.owner
scene=bge.logic.getCurrentScene()
P=scene.objects['pelvic']

sens = cont.sensors['Named']

if sens.positive and P['On']==True:
ownV=own.worldLinearVelocity
own.worldLinearVelocity.x=(own.worldLinearVelocity .x*.6)+P.worldLinearVelocity.x*.4
own.worldLinearVelocity.y=(own.worldLinearVelocity .y*.6)+P.worldLinearVelocity.y*.4
own.worldLinearVelocity.z=(own.worldLinearVelocity .z*.6)+P.worldLinearVelocity.z*.4
P.worldLinearVelocity= ownV*.1+ P.worldLinearVelocity*.895


ownAng=own.worldAngularVelocity
own.worldAngularVelocity.x=(own.worldAngularVeloci ty.x*.9)+P.worldAngularVelocity.x*.1
own.worldAngularVelocity.y=(own.worldAngularVeloci ty.y*.9)+P.worldAngularVelocity.y*.1
own.worldAngularVelocity.z=(own.worldAngularVeloci ty.z*.9)+P.worldAngularVelocity.z*.1
P.worldAngularVelocity= ownAng*.05+ P.worldAngularVelocity*.845
if sens.positive and P['On']==False:
ownV=own.worldLinearVelocity

own.worldLinearVelocity.x=(own.worldLinearVelocity .x*.9)+P.worldLinearVelocity.x*.1

own.worldLinearVelocity.y=(own.worldLinearVelocity .y*.9)+P.worldLinearVelocity.y*.1

own.worldLinearVelocity.z=(own.worldLinearVelocity .z*.9)+P.worldLinearVelocity.z*.1
P.worldLinearVelocity= ownV*.01+ P.worldLinearVelocity*.99 

main()
this is what I am doing now, but it's not using the rigid body chain, but it looks ok,

Can anyone direct me to another method of fluid movement of a rag-doll, that looks like it's not "slack?"

https://www.youtube.com/watch?v=Y9xyFyLmHng

Re: Realistic momentum transferring in walking ragdoll,

Posted: Tue Jul 08, 2014 7:26 pm
by kingchurch
This is not physics simulation. Since you prescribed the velocities of your rigid body parts what you did is just forward kinematic at velocity level. You're better off key framing such animation directly in Blender with a standard Rig setup. For dynamics simulation of Ragdoll you'd want to apply forces to the bodies/joints instead of blasting in velocities like that.