{"id":13662939,"url":"https://github.com/sergioabreu-g/active-ragdolls","last_synced_at":"2025-04-25T13:30:52.129Z","repository":{"id":45206824,"uuid":"296043924","full_name":"sergioabreu-g/active-ragdolls","owner":"sergioabreu-g","description":"Active Ragdolls in Unity","archived":false,"fork":false,"pushed_at":"2021-02-02T14:51:32.000Z","size":2972,"stargazers_count":304,"open_issues_count":3,"forks_count":70,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-11-10T19:33:02.854Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sergioabreu-g.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-16T13:39:32.000Z","updated_at":"2024-11-06T09:44:13.000Z","dependencies_parsed_at":"2022-09-22T19:50:54.664Z","dependency_job_id":null,"html_url":"https://github.com/sergioabreu-g/active-ragdolls","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergioabreu-g%2Factive-ragdolls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergioabreu-g%2Factive-ragdolls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergioabreu-g%2Factive-ragdolls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergioabreu-g%2Factive-ragdolls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sergioabreu-g","download_url":"https://codeload.github.com/sergioabreu-g/active-ragdolls/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250824871,"owners_count":21493355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T05:02:12.704Z","updated_at":"2025-04-25T13:30:50.091Z","avatar_url":"https://github.com/sergioabreu-g.png","language":"C#","funding_links":[],"categories":["C\\#"],"sub_categories":[],"readme":"# Active Ragdolls in Unity\n\nRagdolls that physically play animations through the use of joints and rigid bodies.\nMade with Unity v2020.1.9f1.\n\n![Unity Active Ragdolls preview](_doc/preview.jpg)\n\n## Getting Started\n\nYou just need to clone or download this repository and open the project with Unity.\nIt's made in Unity v2020.1.9f1, but other versions will surely work fine, especially\nnewer ones.\n\n## Guide of use\n\nActive ragdolls are quite messy to make. To avoid as much pain as possible and\nkeep everything under control, I made a simple architecture that makes it all\nmore maintainable and understandable.\n\n### Structure\nAn Active Ragdoll is a ragdoll that can apply forces to move itself. In this case\nthe Active Ragdoll tries to replicate animations through the use of joints\nthat target the rotations of an animation. The structure of an Active Ragdoll\nis the following:\n\n- A parent GameObject that encapsulates two bodies, one plays standard animations\nand the other one is the ragdoll that tries to follow it with physics. This parent\nobject contains the main ActiveRagdoll script, the basic code block to which\nModules can be attached. Those modules contain independent functionalities\nwhich allow the character to perform different actions. A behavior script\nis also attached to this GameObject (this is all better explained in the next\nsection).\n\n- An animated body. This is just a standard animated character, whose animation\nwill be physically copied by the ragdoll. The actual model is disabled because\nwe do not want to see it, we want to see only the ragdoll. But disabling it\nstops animations from being played, so the animation mode of the Animator component\nmust be changed to 'Always animate'.\n\n- A physical body. This is a duplicate of the animated body, but with some major\nvariations. First of all, the animator is still there, so certain functionality\ncan still be used (such as getting the transforms of certain body parts), but\nit doesn't play any animation. The objects that comprise the body (left forearm,\nright thigh, neck...) are each given a RigidBody and connected among themselves\nby ConfigurableJoints, becoming what's essentially a ragdoll. All the ConfigurableJoints\nare then set up to apply torque to reach a certain rotation (these are called\nAngular Drives and Target Rotation). This rotation is set to be that of its\nequivalent body part from the animated body previously described. For example,\nthe left forearm joint target rotation will be set to the animated forearm\nrotation. This way every joint will target its animated peer rotation, replicating\nthe original animation with physical movement.\n\n### Code\nIn terms of code, the behavior of the Active Ragdoll is divided into modules.\nThis allows different functionalities to be completely independent to one another,\nand makes the code much easier to maintain. The code architecture can be described\nas follows:\n\n- A script 'ActiveRagdoll' that acts as the main pillar of the rest of the code.\nIt contains very basic functionality, the least possible that allows the rest\nof the modules to work together.\n\n- Modules are just scripts that contain a specific functionality. They are\ncompletely independent from each other, and can be easily attached and detached.\nIt's important to remember that they do not do anything by themselves, they\nprovide function, not behavior. For that we need the following script.\n\n- A behavior script attached to the parent GameObject. It tells the ActiveRagdoll\nwhat to do: what input to take, what actions should be taken in what situations,\nhow to react to a specific environment change... To understand it better: ActiveRagdoll\nand its modules act like an API, this script is used to control that API.\n\n## Built With\n\n* [Unity](https://unity.com/) (v2020.1.9f1)\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](_doc/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.\n\n## Authors\n\n* **[Sergio Abreu García](https://sag-dev.com)**\n\nSee also the list of [contributors](https://github.com/sergioabreu-g/active-ragdolls/contributors) who participated in this project.\n\n## License\n\nThis project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n* [MetallCore999](https://www.youtube.com/channel/UCB20-wZ22vU9tTieg6_Bx9g) for inspiration.\n* [Michael Stevenson](https://github.com/mstevenson) for its Configurable Joint Extensions script.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergioabreu-g%2Factive-ragdolls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsergioabreu-g%2Factive-ragdolls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergioabreu-g%2Factive-ragdolls/lists"}