Realistic momentum transferring in walking ragdoll,

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
BluePrintRandom
Posts: 47
Joined: Sun Oct 27, 2013 4:16 am

Realistic momentum transferring in walking ragdoll,

Post 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
kingchurch
Posts: 28
Joined: Sun May 13, 2012 7:14 am

Re: Realistic momentum transferring in walking ragdoll,

Post 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.
Post Reply