Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by bbeckford · Jan 07, 2014 at 10:43 PM · animationphysicscharactercontrollerragdoll

Character Contoller with Ragdoll

Could someone point me in the right direction of a tutorial showing me the right way to do this?

I have a character walking left to right across the screen, he is controlled by a character controller and I have all his animation setup correctly. I now want him to ragdoll to the ground when he dies, on collision with certain objects in the world.

I've used the ragdoll wizard, and at first I had a problem where the character was glitching about up and down the y axis. I guessed this was because the ragdoll was colliding with the character controller, so I went through disabling all of the colliders created by the ragdoll wizard, and enabling them again in code once the Character Controller detected a collision. This works but is still quite glitchy when the character ragdolls and also the ragdoll seems to lose all momentum the character had before the collision. I tried using Physics.IgnoreCollision(charController.collider, hit.collider); when it collides but this doesn't help.

Am I going totally the wrong way about this??

Any tips greatly appreciated :)

UPDATE

Still struggling with this, am I supposed to apply a force to the ragdoll similar to the walk speed? If so how would I go about this?

Thanks!

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image instruct9r · Jan 07, 2014 at 11:24 PM 0
Share

Are you trying to do something like in the game "Limbo"? If so don't spend time on it. It doesn't work this way :). Big companies are spending millions to develop behaviours similar to this and it won't work just by attaching ragDoll to your character... The only way you can do this is by faking it with a lot of additional animations that get triggered at certain events....

If you are trying to do something else and i didn't understand the question, then ignore my comment :)

avatar image bbeckford · Jan 08, 2014 at 09:26 AM 0
Share

No not limbo, just ragdoll on death please :)

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Vyross · Jan 08, 2014 at 12:01 AM

Typically, what you do is enable ragdoll when a certain action occurs (like death, or hitting the ground). Otherwise, you'd use standard animation.

Even in a game with as complex of animations as Assassin's Creed, the ingame character isn't a ragdoll. Rather, the animation team creates thousands of small animations, which are blended to create dynamic looking movement.

Often, there's some code combined with animation. For example, in Grand Theft Auto (IV and V), if you stand with one leg on a kerb and the other on the street, you'll see the leg bend dynamically. This is done with inverse kinematics, which is done with a combination of code to check for ground beneath the character's feet, and an animation rig, which is a set of "bones" and their relations to each other.

In the same example, however, when your character moves their torso around, pops their neck, or lights up a cigarette, those are pre-made animations, and there is nothing dynamic about them. They are triggered when the character is registered as idle, and they occur randomly.

To control this kind of setup, you'll need to determine which animation to run based on the state of the character. Running and walking, idle, jumping, and so on, each typically have a pre-baked animation. This question addresses how to blend animations in Unity http://answers.unity3d.com/questions/19789/animation-blending.html

However, to do dynamic animation, like checking for height to the floor, you may have to do this manually (unless there are utilities that I'm not aware of). Doing this manually will consist of writing a much more in-depth set of state-checking functions. For example, with the legs-on-stairs idle scenario, you could create null gameobjects at the limit of the character's legs, and corresponding ones at their hips. Then, do a raycast from hips to feet, and draw the foot wherever the raycast hits, unless it goes beyond the limit. If using a rigged model, you may be able to get the knee and leg to look normal. Note, however, that inverse kinematics (IK) rigs have a tendency to do "wonky" things. You might find it easier to animate a leg-up position, and blend it with a leg-down position. Not having tried it in Unity (only UDK, and that was some time ago), I couldn't tell you which to do.

For 2d in unity, however, there exists a set of tools that will allow you to animate in-editor and do blending there. You could therefore probably do a lot more dynamic things. I haven't used it, so I can't attest to it's usability.

tl;dr : don't use ragdolls except for when your character goes limp. Use other methods for when the player has control, or when a pre-determined action is taking place.

Also, I believe ragdolls on death are illegal in Germany, due to anti-violence/gore legislation. They may also be illegal in Australia. Probably not something to worry about, though.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image bbeckford · Jan 08, 2014 at 09:26 AM 0
Share

Wow thanks for taking the time to write that answer!

Unfortunately I don't think we're quite on the same page, all I want to do is have the character ragdoll on death, I don't want to do anything special whilst he's still alive.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

how can i make my character run up ramps like in sonic, fancy pants or even line rider? 1 Answer

Character animation/ragdoll problem 1 Answer

Character Controller + Animation Not Working As It Should 0 Answers

Best way to move a rigid body to an empty's position? 0 Answers

Question about pushing objects, "Animate Physics" and Rigidbodies 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges