Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 RER1200 · May 20, 2020 at 10:47 AM · animationrigidbody2dphysics2dtorqueangularvelocity

Angular velocity not affecting Rigidbody2D

I have a simple Rigidbody2d which is linked to the parent of a humanoid character in a side-view. The goal is to have the character jump and do a backflip by applying torque to the rigidbody. This character is animated which I know could prevent the object from rotating when it has angular velocity but animations only affect the children of the object. None of these children have rigidbodies. I set the angular velocity directly in a script to give the object a sudden burst of rotation. After that I use AddTorque with a ForceMode2D.Force to mantain a rotation speed since the angular drag of the rigidbody is set to 2. Here is a screenshot of the setup : alt text The second animation event triggers a method which sets the angular velocity. Here is the code of this method : public void ApplyImpulseRot(){ if (goodJump) { rb.angularVelocity = rotationImpulse; Debug.Log(rb.constraints + " " + rb.angularVelocity); goodJump = false; } }

I added the Debug.Log to verify that the rigidbody has no constraints when applying the angular velocity and that the velocity is correctly applied. When playing, this debug logs "None 60" which shows that the problem is not linked to either of these possible issues. I have a second Debug.Log in the FixedUpdate that logs the angular velocity at every physics calculation and this shows me the expected behaviour of the angular velocity during the player's jump (the velocity starts at 60 and then increases until the player returns to a grounded state at which point the velocity is set to 0 because the rigidbody becomes constrained for the z rotation). When I check the object with the rigidbody's rotation it stays fixed for the whole jump. No changes to the rotation at all. Another wierd thing is that when increasing the burst of angular velocity to a very high value (from 60 to 10000 for example) the object still doesn't rotate but shoots up in the air. Here is a screenshot of a frame during the jump where the console shows the angular velocity and where we can also see the rigidbodies rotation which by default is 0 : alt text

I really can't understand why the object is not rotating. Your help is much appreciated.

Update : the problem is due to the animation. I have tried running the game jumping and waiting for the velocity to be applied by the animation event. After that I pause the game turn off the animator and only then does the object start rotation. The weird thing is that the rotation of the Runner gameobject is not a paramater of the animations running during the jump. I still need help to understand why the animator is preventing the rotation of the object.

screenshot-2020-05-20-at-124101.png (349.9 kB)
screenshot-2020-05-20-at-122748.png (337.8 kB)
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
Best Answer

Answer by RER1200 · May 20, 2020 at 11:25 AM

I've now fixed the issue. By removing the property concerning the rotation of the Runner gameobject in all animations of the animator, the object now rotates according to its rigidbody's angular velocity. I still don't understand why a parameter of an animation not running at the time affects all other animations of the object. I'm not sure if this is a bug or a hidden consequence of the way the animator works but the easy fix is to remove the parameter from all animations and control the rotation using a script.

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.

Follow this Question

Answers Answers and Comments

317 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 avatar image avatar image

Related Questions

How to rotate a Rigidbody2D faster than 4500 (degrees/s)? 0 Answers

rigidbody2D.AddTorque() works differently on iOS, in editor and in web player 1 Answer

After AddTorque, the resulting angularVelocity depends of the RigidBody's velocity? 0 Answers

How to disable collisions without disabling rigidbody? 1 Answer

Rotate a 2D Rigidbody to a desired angle using AddTorque? 3 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