DEV Community

Sunder Iyer
Sunder Iyer

Posted on

1

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

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay