Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 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 TyGuy223 · Aug 12, 2020 at 03:41 PM · buganglehingejoint

hinge.angle returns wrong angle

While trying to use Unity as a simulation environment for robotics, I've come across a pretty serious bug. In order for me to control a robot arm in my scene, I need to have access to the angles from HingeJoints. However, when I use

 hinge = GetComponent<HingeJoint>();
 angle = hinge.angle;

hinge.angle does not always provide the actual angle between a HingeJoint rigidbody and the connected rigidbody. The angle returned seems to be dependent on the global orientation of the connected rigidbodies, in addition to their relative orientation.

As an example I've included a link here to a package that contains a scene called test_scene with a 6 DoF robot arm I made as an example. The arm has springs in most of its joints to stop it from completely flopping around, and has some scripts attached to report the angle I calculate and the error between it and hinge.angle. You can see the steady state orientation of the arm and the scripts below.

alt text

The HingeJoint connecting the shoulder to the base is told to rotate at constant velocity, meaning the shoulder HingeJoint should be the only one with a changing angle. If you play the scene and look at the shoulder GameObject under the hinge_angle_tester, you'll see the errorAngle is approximately zero as the arm rotates around. Looking at arm_1 however, shows that errorAngle is changing continuously as the arm rotates, and can be as large as 180 degrees.

This is not only a problem because it forces me to manually calculate hinge angle/velocities, but it also results in hinge damping providing unrealistic torques since Unity thinks the angle is changing when it isn't. If I wanted to I could also calculate my own damping, but I also need to be able to set limits for my HingeJoints, which I see as being an even more annoying can of worms to deal with.
I've seen this issue raised before in this Unity forum back in 2016, and it is obviously still a problem. I hope that someone can shed some light on why this problem exists, or confirm that it will eventually be fixed. Please let me know if there is anything else I should provide, and I have submitted a bug report.
My System

Windows 10 running Unity 2019.4.7f1

unity-hinge-angle-error.png (171.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

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

152 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

Related Questions

OnTriggerEnter fired incorrectly (android device only) 0 Answers

reproducing hingejoint.angle 0 Answers

HingeJoint has a little bug? 0 Answers

Why are my hinge joints inaccurate? 1 Answer

Why does using a second animation layer not work with animation rigging? 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