2
\$\begingroup\$

I'm trying to make an effect that a ragdolled character controlled by an animator also affected by the physics collisions. Similar to this game: Crazy Shopping.

The problem is animator controller overrides every change that happens in the Fixed Update or internal physics update (even when the animator update mode set to Animate physics). enter image description here

I think this can be achieved by some how changing the order of execution of the animator so it can happen before physics update. This way physics can affect the animated object. There are solutions like using a second object which contains the ragdoll and in the LateUpdate you can set the positions and rotations of the animated object which works ok but not the thing in my head.

ActiveRagdoll by MetalCore999 is also a really great work which i would love to learn how it works in behind.

How can i achieve this? i don't even know if my solution would work properly?

Do you have any suggestion or a different way of thinking. I would really appreciate a road map on this.

\$\endgroup\$
7
  • 1
    \$\begingroup\$ If you changed the order of execution of the animator (a thing I'm pretty sure isn't possible without breaking into Unity's offices), the objects would still reset to the positions determined by the animator each frame, it would look almost like the animation, but a little saggier. \$\endgroup\$
    – Foxwarrior
    Jan 26, 2020 at 8:35
  • \$\begingroup\$ I think Crazy Shopping just has the old-fashioned swapping between ragdoll and animation technique, where the animations happen to be kind of wobbly, and maybe there's some blending in there too. ActiveRagdoll probably doesn't use an Animator at all, just some math to tell the feet where to go when they walk. \$\endgroup\$
    – Foxwarrior
    Jan 26, 2020 at 8:38
  • \$\begingroup\$ @Foxwarrior You're probably right, changing the execution order would just create more problems. But i know that crazy shopping using some kind of ragdoll-animation blending, i played and tested. It reacts collisions while animation still playing this gave me the crazy idea of changing the execution order. \$\endgroup\$
    – Arlandria
    Jan 26, 2020 at 12:29
  • \$\begingroup\$ I'd agree with Foxwarrior that changing the execution order just moves this problem, it does not solve it. I'd recommend editing your question to ask "How can I blend an animated character with ragdoll physics collisions?" — always focus on the problem that you want to solve/the end you want to achieve, not your best guess so far about how to achieve it. Though it looks like ActiveRagdoll you already have a candidate solution. Is there something you need that this asset isn't doing for you currently? \$\endgroup\$
    – DMGregory
    Jan 26, 2020 at 13:10
  • 1
    \$\begingroup\$ @DMGregory Thank you for reminding me to actually searching in the github, I searched google over and over with different keywords but forgot about github and found some satisfying results, I will post a detailed answer. \$\endgroup\$
    – Arlandria
    Jan 27, 2020 at 19:53

1 Answer 1

2
\$\begingroup\$

There is an inverse kinematic method for blending animation with physics, it basicly tries to keep the same position and rotation of bone structure of another animated object with the ragdoll, after physics applied to the ragdoll it updates the bones in the late update. Link is here: Active Ragdoll

But I found another way around for this problem its not perfect, but it works for me. The idea is like this: for each ragdoll joint object(nodes with a character joint component) you create an empty parent node at the same position with the joint object and you use this parent object for all of the animations. That way animation does not interfere with the physics system. It should look like this: Hierarchy

After changing all of the joint objects you want to animate, you must use this parent objects in the animation panel.

Warning

If you do this you can't use mixamo animations because they use Avatar bone structure.

Maybe you can use blender for changing the armature of model and add animation joint nodes in there and configure avatar bones in the unity, but again i'm not sure if it would work.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .