DEV Community

Sunder Iyer
Sunder Iyer

Posted on

TIL GameCreator Ragdoll Control

2021-05-24

It's often quicker/simpler/efficient to write code instead of setting up a visual script. But there's something to be said for expressing the same result in an elegant visual script. It's like a creative restriction.

To control a Game Creator Ragdoll, one can loop through and alter the rigid bodies that get auto-generated at runtime.

One could search for the rigid bodies by component but I opted to store them in a List of GameObjects on the Character itself. It's a small list of 10 objects: spine, head, 4 legs and 4 arm pieces.
List of rigid bodies that make up the ragdoll, pre-stored

Once that's done, it's just a matter of modifying the rigid bodies by looping through the list.
An Action that modifies and resets rigid bodies
The Modify action applies some upward force and turns off Gravity and ensures Is Kinematic is not turned on.
Modify
The Reset action sets Gravity back to the original value.
Reset
End result:
Animated GIF of a ragdoll being tossed and temporarily suspended

Top comments (0)