-
Notifications
You must be signed in to change notification settings - Fork 0
29‐03‐2024
- Wrote a Plan of Approach. That will get iterated on in the future, so there will be a seperate page for it for ease of access.
- Started researching ragdolls in Unity
- Continue researching and start implementing ragdolls in Unity
- ?
As mentioned yesterday, I found a great official resource from Unity that should help me easily make use of ragdolls.
With the resource's help, I started off with this ragdoll created from a character downloaded at Mixamo
There are still some things in the ragdoll that have to be fixed before I can start using it, but it's a great basis to start working from. For example:
- There are no colliders/joints for the hands and feet yet
- The colliders for the other body parts are way too big
Now, these issues have been fixed. You can see the ragdoll visualized better with the Physics Debugger window enabled. The body part collider are more proportional now, and colliders & joints have been added for the hands and feet.
Something else I am able to customize is the rotation each limb can rotate. In the screenshot above, you can see gizmos for each axis, which control how far the limb can rotate in that direction. For now, the default values are fine.
And they work fine, (almost) right out of the box!
So, how do I get the ragdoll to stay upright? Since it's completely controlled by the physics system in Unity, I'll need to apply an upright force at all times. I couldn't find any existing free assets on the AssetStore to do that for me, so for this as well, I will have to find a tutorial if I don't want to spend the majority of my time programming ragdolls. That's not the point of this course :)
RagdollTest2.mp4
After doing some tests with adding an upright force to the torso joints (and not getting the results I wanted), I noticed that multiple sources (Reddit, Tutorial) mentioned using a Configurable Joint instead of a Character Joint, which was the joint automatically added to the mesh by Unity. Since there is as far as I could find no documentation on ragdolls with Character Joints, I decided to replace all the Character Joints with Configurable Joints. This made it much easier to make sure the character stays upright.
RagdollWalking.mp4
In this video, you can see the character staying somewhat up (although it seems quite stiff at the moment), and by applying a force to each leg when pressing the left/right mouse button, the ragdoll is now walking! Right now, that's obviously done by me. But by repeating the concept of teaching an agent to move somewhere by applying a relative change to its position, I can do the same for the rigidbodies. But instead, tell it where it needs to go and it will (hopefully) figure out the correct force and direction to apply to itself on its own.