R3X-G1L6AME5H / Godot-Active-Ragdolls

Godot plugin that allows for Active Ragdoll simulations.
MIT License
48 stars 4 forks source link
animation simulation

Active Rigid-Body Ragdoll

In summary...

A Godot plugin for Ragdolls that uses RigidBody, and Generic6DOFJoint instead of PhysicalBone. This allows for much more options regarding Ragdolls. The Godot's default ragdolls that use PhysicalBones are generally all you will need in your game, however if you are trying to implement something special like Active Ragdolls, you will find PhysicalBones to be unsatisfactory.

Example of ragdolls

WARNING

Usage

Its quite simple. There are three relevant scripts. CreateRagdoll.gd is responsible for creating RigidBody bones, and 6DOFJoints for the skeleton. RagdollBone.gd applies the RigidBodys transform to its respectable bone in the parent Skeleton. Finally, ActiveRagdollJoint.gd connects RagdollBones together, and attempts to match it's rotation with the animated skeleton.

To understand what all this means, may I humbly reffer you to my seniors: Birdmask, and Sergio Abreu.

CreateRagdoll.gd

This script goes on a Skeleton node. Treat tick boxes as buttons. They should always be unticked. If not, close your scene and open it again. Be careful because these actions cannot be undone with Ctrl-z.

Overall, this script has 4 properties:

Finally, there are two relevant methods in this script: start_tracing() and stop_tracing(). On runtime, this can make the ragdoll go between following an animation, and going fully limp.

Overgrowth's Active Ragdolls

RagdollBone.gd

These are simply RigidBone nodes that that act as bones for the ragdoll. Their only purpose is to simulate physics, and apply their Transform to the relevant bone in its parent Skeleton. This node MUST be under a Skeleton node. It will do you good to assign some accurate weights to the RigidBodies for better simulations.

ActiveRagdollJoint.gd

Generic6DOFJoint can imitate any other type of joint, provided that you know how to configure them. Aditionally, it provides motors that can move the ragdoll bones using forces. Tapping into the powerful potential of these Joints is the entire reason for this plugin.

Types of Kinematic Joints

Active Ragdoll Joint has a few properties: