[video]Ragdoll and hkaRagdollPoweredConstraintController issues

[video]Ragdoll and hkaRagdollPoweredConstraintController issues

Hello everyone,

Sorry for the two topics, but I'm having problems with the yt link - I can't create a topic with it, nor can I edit the previous one... Don't know if its a new user restrictions or boards policy in general.

I'm having a problem with my ragdoll simulation. I'm following as an example animations showcase demo, so far I have implemented successfully all the ragdoll initialization part and ragdoll driving to animation with support of hit reactions. I've also kinda got standard ragdoll scenario to work, but only  by not using the hkaRagdollPoweredConstraintController. Please check the included video to observe what happens, any ideas on what could cause this ragdoll "freezing" are more then appreciated. If more details are in order, just let me know. Below is a code snippet and a mentioned video.


void cHkRagdollAnimations::UpdateRagdollToMatchAnimation(hkaPose& pose, float dt)
    // Get the ragdoll's reference pose in model space
    // We use this pose as the in+out pose to the mapper below
    const hkaSkeleton* rSkel = m_ragdollInstance->getSkeleton();
    hkLocalBuffer<hkQsTransform> ragdollModelSpace( rSkel->m_bones.getSize() );
    hkaSkeletonUtils::transformLocalPoseToModelPose( rSkel->m_bones.getSize(), rSkel->m_parentIndices.begin(), rSkel->m_referencePose.begin(), ragdollModelSpace.begin() );
    // Map the pose from the animation (highres) to ragdoll (lowres)
    m_highResToRagdollMapper->mapPose( pose.getSyncedPoseModelSpace().begin(), rSkel->m_referencePose.begin(), ragdollModelSpace.begin(), hkaSkeletonMapper::CURRENT_POSE );
//with this block commented out, the ragdoll works  
        // Drive the powered constraints to this ragdoll pose using a controller
            hkLocalBuffer<hkQsTransform> ragdollLocalSpace( rSkel->m_bones.getSize() );
            hkaSkeletonUtils::transformModelPoseToLocalPose( rSkel->m_bones.getSize(), rSkel->m_parentIndices.begin(), ragdollModelSpace.begin(), ragdollLocalSpace.begin() );
            hkaRagdollPoweredConstraintController::driveToPose( m_ragdollInstance, ragdollLocalSpace.begin() ) ;
    // Get the current pose from the ragdoll, map it back to the character
        m_ragdollInstance->getPoseModelSpace(ragdollModelSpace.begin(), m_currentTransform);
        const hkQsTransform* localBIn  = pose.getSyncedPoseLocalSpace().begin();
        hkQsTransform*       modelBOut = pose.accessSyncedPoseModelSpace().begin();
        m_ragdollToHighResMapper->mapPose( ragdollModelSpace.begin(), localBIn, modelBOut, hkaSkeletonMapper::CURRENT_POSE );

And btw, yes, I could live with this what I already got, but I want to also implement getting up from ragdoll, so I need to be able to drive ragdoll to a specific pose :)

Thx in advance!

Download havokragdollissues.mp42.55 MB
4 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

Hi Ebol--

The most likely cause of your stiff ragdoll is that the motors on your ragdoll's constraints are too strong. Try decreasing both m_minForce and m_maxForce for each motor in your ragdoll.

Typically, a powered ragdoll is used to blend in and out of ragdoll - for example, to blend out of ragdoll into a death pose, or to blend gradually from say a walking animation (fully keyframed) to a stagger (half keyframed, half ragdoll) to total collapse (fully ragdoll). If you can provide more information describing the kindof behavior are you trying to achieve, I may be able to provide more guidance. Thanks!


Hi Tim,

I tried lowering min\max forces on ragdoll motors like you suggested and ragdoll started to behave better, less stiff, but please tell me something, maybe I got the whole idea wrong or maybe I just coded it wrong:  If I'm trying to to blend from ragdoll to death pose via pose matching (like in the showcase demo) and I have just one test pose with character laying on his back, I should expect the ragdoll to land in this more or less exact position, right?

Because I lowered min\max force on the motors to really low values (considered the default ones) like 5-10, only then the ragdoll stopped being so stiff, but my character not even once landed on his back...

So to summarize, I'm trying to drive my ragdoll to a specific death pose, so I could then implement the "getting up" effect. Think of shooting a zombie which falls on the ground just to stand up a moment later and continue to march ahead ;)

Thank you for your time!

Hi Ebol--

A powered ragdoll doesn't guarantee that the ragdoll will land in a particular way; rather, the Showcase demo selects the best death pose based on how the ragdoll falls naturally. The purpose of the powered controller in that demo is to ensure that the settled ragdoll looks more natural and pushes it closer to the initial get-up pose. For example, the powered controller straightens out the ragdoll's limbs to reduce their tendency to fold up on themselves.  The best way to see the effect of powering the showcase demo is to comment out these lines in AnimRagdoll.cpp and observe how the death/revive sequence changes:

hkaRagdollPoweredConstraintController::driveToPose( m_ragdollInstance, ragdollLocalSpace.begin() );

Even with these lines commented out, the character will still get up; the blending just doesn't look as natural. Look at the function AnimationShowcase::doGetup() to see an example of blending from an arbitrary ragdoll position into a "get up" animation. This is a fairly advanced use case, so please let me know if you have any further questions. Thanks!


Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!