• 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 Runemark · Jun 21, 2013 at 11:04 AM · collisionrigidbodycharacter controllerragdoll

Ragdoll driven game

Ok, I'm working on a pvp based fantasy game with hit detection, and ragdolls. :)

I got the following scenerio:

  • All player characters (later maybe the mobs too) are ragdolls.

  • The character animations are from Animator (with root motion, and physics).

  • In the start method I turn off the "ragdoll mode".

  • When the character attacks any other character, I check if his weapon collides with any bodypart of the enemies body. If it is true, then I turn on the ragdoll mode.

Ragdoll mode on/off function: First turn off/on the freezeRotation value on each rigidbody. Then i turn off/on the animator component on the charater.

This works as I want.

Problem: The main problem is, that in this scenerio, the characters can go through the walls. Second problem: with root motion i dont know, how to create jump effect like with the character controller

What I tried to solve this The following states are in ragdoll off mode.

  • Animation Root(true) + Ragdoll Rigidbodys Kinematic (true) = movement: OK, still goes through the walls, and can't detect the collision between weapon and body part (becouse the last ones are kinematics)

  • Animation Root(true) + Rigidbody in the character root + Capsule Collider in the root = movement: crackling... and still can "crakling" through the wall...

  • AnimationRoot (true) + Kinematic rigidbody on the root + Caps collider on root = Movement is ok, walks through the walls.

  • Character Controller + Anim Root (false) + movement script + bodyparts capsule collider are active = movement is discontinuous and it tends upward. But cant go through wall.

  • Character Controller + Anim Root (false) + movement script + bodyparts capsule collider are'nt active = movement ok, can't go through walls, but can't detect the colloisoon between bodypart and weapon.

I know there are couple of solutions. I found URG!, I downloaded the free version, but it only creates a box collider on the chest (emergency collider if I'm not mistaken). It would be nice, but I don't really want to spend money for this project yet.

In the other hand I want to improve myself, and learn how to do it. Yes, I'm masochist... :D

So, if you have any advice or suggestion, pls tell me. :)

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Kavorka · Feb 02, 2014 at 07:43 PM

This gives you the root motion plus additional control over the movements so that you can do jump.

 void OnAnimatorMove ()
     {
         transform.position += anim.deltaPosition + jumpVelocity * deltaTime;
         transform.rotation = anim.deltaRotation * transform.rotation;
     }   
  

anim is a reference to the animator.

jumpVelocity is zero if not jumping and otherwise
jumpVelocity = mathf.Sqrt(2f 9.82f JumpHeight) - 9.82f * t;

Where t is time since character left the ground.
This will not work perfectly but it will get you started.

If you want a ragdoll game also take a look at this AnimFollow

Comment
Add comment · 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

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

16 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

Related Questions

Player's hands passing through opponent while punching 0 Answers

Disabling Kinematic on hit 2 Answers

Animator overriding collisions? 0 Answers

Ragdollize kinematic rigidbodies 0 Answers

Physics goes crazy when rigidbody collides with moving character controller 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