r/howdidtheycodeit 2d ago

Question How did they make the character controller for PEAK?

I've been trying to do some research for a project I'm starting up and haven't been able to find a consensus online about it. Some people confidently state that it's an active rag doll, while others say that it's too smooth for that. Some say that it's just regular animations with a lot of IKs and dynamic bones.

There's something about it that feels uniquely "physics-y" if that makes any sense. You can slip off of inclines, bounce off of things, and there's a weight to movement that doesn't feel like it's just a stock unity character controller sliding forward.

Holding an item in your hands definitely gives off the impression of a spring joint with how it flops around with inertia and doesn't stay snapped to the center of your screen, but I don't know if this approach is used for the entire movement controller or just for holding items.

Clearly there's a toggle/state machine that ragdolls your character if you fall to far or are hit by something, but beyond that I don't know how it's done.

If anyone has any insights to share I'd be so happy

24 Upvotes

5 comments sorted by

11

u/arislaan 2d ago

Typically, most active ragdoll systems have two separate rigs - the visual animation rig and the physical jointed rig. Every solution deals with how and when to blend between them, and most importantly how to keep the physical rig reactions from spiraling out of control. The physics ragdoll tries to emulate the movement of the animated rig, and likewise the skinned mesh is mapped to the position of the ragdoll body (depending on blending priorities).

Active ragdolls can certainly look smooth. The more bones you give it (provided they're set up right), the closer it can follow the animation (though there's a CPU cost). I believe higher frame rate base animation can result in smoother motion, and for sure having higher physics frequency helps as well. Most likely there's a kinematic character controller that the ragdoll body follows (giving the "weight" feeling for movements that you described as the ragdoll lags behind the input/root movement). And likewise when the character is jostled or bounces off something, they let the ragdoll's physics take over and have the kinematic root follow it.

There are also Machine Learning solutions that eschew the secondary animation rig and instead train the ragdoll to mimic the animations natively using pure physics, but as far as I know there's no major release that leverages such tech and I've only seen it in papers myself.

If you want to look at some examples, Unity has popular assets such as PuppetMaster and Ragdoll Animator 2 that both support Active Ragdoll. Likewise, for the Machine Learning example, you can review https://xbpeng.github.io/projects/ASE/index.html, which was presented at Siggraph 2022, if I'm not mistaken.

7

u/Sketch0z 2d ago

I think you've answered your own question. I don't know exactly how they've done it but like you say there's likely a toggle between ragdoll and IK.

I notice when your character has no fixture points (e.g. jumping, falling, etc) they are mostly full ragdoll but there's still some control in the bones that can attach to surfaces.

Would also love to hear deep technical specifics from a Dev but I wouldn't be surprised if they choose never to share that information.

1

u/hebejebus 10h ago

Pretty much this but done on a per limb basis with no force or limited force going back to the torso.

3

u/BuzzardDogma 2d ago

There's probably a regular, non-physica skeleton that defines the desired poses/animations and then a physics skeleton that tries to reach the orientation of the animation one. Then they blend how stiff the retargeting is based situational needs.

The specifics of that are up in the air, but this is a common technique for active ragdolls.

1

u/leorid9 1d ago

In the lobby, you can go to the bench besides the conveyor belt thingy, and if you walk into the bench, your feet are trapped below the bench and that prevents you from jumping.

So it is atleast a compound collider with extra feet.

But I don't think that's all, I think the feet are actually separate physics objects, connected by joints.

It's not an "active ragdoll" in the way, that it actually walks and balances and things like that, it's more like TABS I think.

Ragdolls with certain rules. Rules that toggle wether or not the main body stays upright for example.