Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Harry64 · Jan 01, 2014 at 07:25 PM · rotationeulerangleschildrengimbal-lock

rotate a object around the x axis like other object... stucks at 90 degrees

I really need now some help with this because I wasted already a week with my script because I thought it was something wrong with it but now I found out it was the euler angle 90 degree problem....

ok imagine 2 objects. the 2 objects have 2 children. object 1 has child-A. object 2 has child-B.

now I want that child-B's eulerAngle.x should be the same rotation as the x axis of child-A.

But as I sayed above it stops at 90 degree and then it starts turning backwards till 270 or something... and then it rotates again normal till 90 degree.

Child-B should only rotate around his X axis. and there is the problem....

how do I get a perfect X value of Child-A. please help.

Edit: Here is the code I am using now.... I have 3 bones here because I need then later to rotate the first one 99% the second 66% and the third 33% with the palm.

 var forearm1 : Transform;
 var forearm2 : Transform;
 var forearm3 : Transform;
 var palm : Transform;
 
 //Debug:
 var palmRot : float;
 var forearmRot1 : float;
 var forearmRot2 : float;
 var forearmRot3 : float;
 
 
 function Update()
 {
     var xRotation = palm.rotation.eulerAngles.x;
     
     forearm1.localRotation.eulerAngles.x = xRotation;
     forearm2.localRotation.eulerAngles.x = xRotation;
     forearm3.localRotation.eulerAngles.x = xRotation;
     
     
     //Debug
     palmRot = palm.rotation.eulerAngles.x;
     forearmRot1 = forearm1.localRotation.eulerAngles.x;
     forearmRot2 = forearm2.localRotation.eulerAngles.x;
     forearmRot3 = forearm3.localRotation.eulerAngles.x;
 }
Comment
Add comment · Show 2
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 robertbu · Jan 01, 2014 at 07:37 PM 0
Share

You need to show us the code you are using.

avatar image Harry64 · Jan 01, 2014 at 10:51 PM 0
Share

here is the code... I really need help here.

maybe I could get it to work with a workaround like an empty as an referencerotation or something....

its sooo odd... the other axes rotates a full 360 rotation only the x axis does this wierd from 0 to 90 and backwards to 270 thing....

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Harry64 · Jan 01, 2014 at 11:37 PM

I made some progress now... I put now every bone into an empty that where so rotated that now the z axis needed to be rotated... it looks now promising. I get now a full 360 rotation.

still it would be great if there would not be a need to put every bone into an empty.... rotating the bones in Blender would require again more work... if there is no other solution I think then I would need to rotate the bones in Blender...

but this is odd why does every other axis works perfect but only the damn x axis not....

Edit + Answer:

Ok I think the best solution in my case is if I use the emptys or I rearrange the bones in Blender.

It really seems that the X axis is in unity not able to rotate a perfect 360 degree round. I will use the Z axis or the Y axis. they seem to work like they should...

you all can try it for yourself. put an Empty into a unity scene and set it so you see the local rotation. then try to rotate the Empty on the X then Y then Z axis a full round and you will see that the X axis dont work as expected.

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

Answer by HappyMoo · Jan 01, 2014 at 07:55 PM

Do you really need the angle value or just want to set the same rotation on both childs? Because internally Unity uses Quaternions and when you convert this to Euler angels, you can get strange values.

If you just want the same rotation, just do

 childB.transform.rotation = childA.transform.rotation;
Comment
Add comment · Show 3 · 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
avatar image Harry64 · Jan 01, 2014 at 08:19 PM 0
Share

child-B should only rotate around its local X axis.... its a bone of a model so I really need the X rotation....

avatar image HappyMoo · Jan 01, 2014 at 08:21 PM 0
Share

and how does the above code not solve this? what's wrong with it?

avatar image Harry64 · Jan 01, 2014 at 08:29 PM 0
Share

it would not solve it... then the model would also rotate to the side and all around... it should only rotate on the transform.localRotation.eulerAngles.x axis... even if the child-A's Y and Z axis are rotated in any other direction....

I would need a value from 0 to 359. If I had such a float var I could just map it right to the bone...

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

19 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

Related Questions

Clarifying the ambiguities of rotation in Unity 1 Answer

Rotation of child object is different in play mode 0 Answers

Why Is Object Rotation Resetting After 90 or -90 Degrees 0 Answers

unwanted rotation on the y and z axes 1 Answer

Rotation Complications + rotation with parents and children? 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