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 JmD_2 · Sep 20, 2011 at 02:14 PM · rotationquaternioneuleranglesconfigurablejoint

ConfigurableJoint - angular positions (rotation) problem

I'm using ConfigurableJoints for a mechanical rig. Some some joints have 1 DOF (angular X), some joints have 2 DOF (angular X,Y) and some joints have 3 DOF (angular X,Y,Z). I switch between velocity mode and position mode - velocity mode when I'm moving the joint, and position mode when the joint is at the desired position. This works as should.

Problem is when rotating the joint beyond 90 degrees around any axis. I "measure" the actual position (rotation) of the joint by using:

(Quaternion.Inverse(_ConnectedRigidBody.rotation) * _JointRigidBody.rotation).eulerAngles

If I for example rotate the X-axis of the joint, the measured x-value is fine up to 90 degrees. When the rotation > 90, the x-value starts to decrease, ie 89, 88, 87, 86 ... Same goes for rotations down to -90 degress - they are fine. But below -90 degrees, the measured value changes direction, ie -89, -88, -87, -86 ...

I have tried different ways of measuring the angle. I have re-inported my meshes with corrected pivot points, I have made children to the rotating parts trying to measure their rotation ... and I always get the same result - measured rotation values are fine up to 90 degrees (or down to -90) and then they change "direction".

I'm guessing there is something about the conversion from Quaternion to euler angles that is the problem, but I know too little about such conversions to figure out how to fix this.

Any idea of what I'm missing out on? Any advice is appreciated.

Thanx in advance ///JmD

Comment
Add comment · Show 3
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 Owen-Reynolds · Sep 20, 2011 at 03:29 PM 1
Share

The problem is that there are several ways to build a facing out of x,y,z Euler angles, using different combinations of numbers. For example (which may be what you are getting) an x-rotation of 95 degrees can be made by rotating 85 degrees in x, then 180 around y.

If you actually need the angle on, say, the x-axis the common trick is to project to the yz-plane first.

avatar image JmD_2 · Sep 20, 2011 at 04:58 PM 0
Share

Thank you for the tip, Owen! I guess that principle works for the other axes as well, ie, for the y-angle, project to the xz-plane first and for the z-angle project to the xy-plane first?

///JmD

avatar image Owen-Reynolds · Sep 22, 2011 at 12:34 AM 0
Share

The thing to be careful about is that the project-to-plane trick gives the world angle, only good for the direction of the "first" spin. Usually when you have x,y,z angles, you're thinking of a spin on the global y, but then the second spin on the new, local z, then on the even newer local x.

So, for combining it won't work (I think,) but for checking against maximums should be fine.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by inum76 · Oct 07, 2015 at 01:17 AM

I found while using scrips, C#, The Rigidbody falls asleep. You need to wake it up within the script during each update. It is a bad idea to mess with a Quaternion directly. You should set XYZ in Euler angles with a vector3.
public Vector3 Vec1; Then you set your Quaternion with it, this way: private Quaternion QVec1; QVec1 = Quaternion.Euler (Vec1); QVec1 would be your set Quaternion with the angles you wish it to have. This is my vid on the subject you ask about, if you wish to check it out. Link: ConfigurableJointScript 1 Hope this helps.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Clarifying the ambiguities of rotation in Unity 1 Answer

Rotating local transform not rotating fully if tranform.up is not exactly at (0,1,0) 1 Answer

How to handler rotation of a Gameobject while aligning it with normals 1 Answer

Object makes random jumps in rotation 1 Answer

Match Y axis rotation. 1 Answer


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