Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 DEADTERMINATOR · Oct 07, 2016 at 10:03 PM · physicsrigidbodygravityragdollkinematic

Problems with ragdolls and no gravity

In the game I'm working on, movement switches between gravity and no gravity (3D). I had it working with my enemies in that they would move properly on the ground, transition to no gravity movement, fall back to the ground when gravity came back on etc. However, I ran into an issue where when enemy bodies that were floating around in no gravity fell back to the ground, they would land in unnatural ways (such as landing on their head upright and remain upright) because they just had body sized collision (so they were just boxes as far as the physics system was concerned). But then the creator of the enemy model asset I was using released a ragdoll version of the enemy, so I decided to swap it out. Here is where I run into issues. I'm doing basically the same thing I was before, plus the additions I figured I needed based on online reading:

  1. I keep a reference to the RigidBody on the character, as well as an array of the RigidBodies on the joints.

  2. I set isKinematic property of the top level RigidBody and the joint RigidBodies to true at the start (for animations and movement).

  3. I set the useGravity property of all the RigidBodies to true or false depending on the state of the game.

  4. When the enemy dies the death animation plays, and after the death animation I set the isKinematic property of all the RigidBodies to false and disable the animator component to enabled the ragdoll functionality.

However, while the enemy still functions properly on the ground, it is now incapable of leaving the ground when gravity it turned off. Additionally, when the ragdoll is activated after death, it behaves very unnaturally. It slowly floats around in the air (regardless of the gravity setting), twitching and spasming until it happens to hit a surface (wall, ceiling, whatever) at which point it launches off like it was shot out of a cannon, completely blasting through any surface it hits next into nothingness. I've even seen the model mesh stretch and glitch out when this happens. Any idea what is going on here, and what I might be missing?

For reference, this is my code that enables or disables gravity on the ragdoll (the kinematic code is basically the same, only with the isKinematic property instead).

 private void SetRagdollGravity(bool gravityOn)
 {
     rigidBody.useGravity = gravityOn;
     foreach (Rigidbody ragdollPoint in ragdollPoints)
     {
         ragdollPoint.useGravity = gravityOn;
     }
 }

I've looked through the hierarchy and confirmed that it doesn't miss any RigidBodies and that it is setting things as I would expect.

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

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Tracking Force Added to Kinematic Rigidbody 2 Answers

How can I make character become a ragdoll with isKinematic? 1 Answer

Disable ragdoll without changing Kinematic boolean? 2 Answers

How to make rigidbodies on each side of a cube fall towards the cube? [multiple gravity / addForce] 0 Answers

Moving a regular Unity primitive and PhysX performance 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