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 Jade · Jan 25, 2011 at 06:00 AM · angleeulerangles

Euler angles have a dead zone near 90?

Hi all, I need to move a texture up and down on the screen based on the rotation of another object. So euler angles sound perfect considering the values are pretty linear with rotation.

The angle value progresses up to about 87, then it hangs there for a few degrees (even though the object is still visibly rotating), and then starts dropping back down. It wont read all the way up to 90, almost like there is a dead zone of 2 degrees around 90.

Anyone know how to solve this, or is there another way to get any sort of linear value for a rotation around 1 axis?

Thanks!

Comment
Add comment · Show 4
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 Jesse Anders · Jan 25, 2011 at 07:01 AM 0
Share

I've never observed anything like that. Can you edit your post to include the code that sets and reads back the rotation for the object?

avatar image Bunny83 · Jan 25, 2011 at 10:33 AM 0
Share

$$anonymous$$y guess is that your object is rotated already in 1 or more axis. You probably mixed Transform.rotation and Transform.localRotation Take a look at http://en.wikipedia.org/wiki/Euler_angles

avatar image Jade · Jan 26, 2011 at 03:23 AM 0
Share

Thanks for the replies. To recreate, add the $$anonymous$$ouseLook script from the Component $$anonymous$$enu -> Camera-Control group. Lower sensitivity to 1, and set the $$anonymous$$imum and maximum properties to -360 and 360 respectively.

Display the eulers and watch the y coordinate: Debug.Log(transform.eulerAngles);

When you look down and the camera approaches 90 degrees, you will see that the y euler rarely goes above 87.5ish. Sometimes it snaps right onto 90, but other times it just hangs out at 87.x

avatar image BenMeijering · Jun 08, 2012 at 11:53 AM 0
Share

I observed the same behaviour as well, I'm adding a small value to the x and y components (z is not touched and stays 0) of a Transform's eulerAngles every frame (navigation code using angular velocity). When setting the x component to 89.9 for example and reading it back, the value became 90.0.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by jonas-echterhoff · Jan 25, 2011 at 09:23 AM

Euler angles have some shortcomings (which is why they are not generally used for internal math in game engines, Quaternions are preferred for that), and since there are multiple ways to represent a specific rotation, you are not guaranteed to get continuous results for rotation along any axis.

However, you should be able to calculate the rotation around an arbitrary axis yourself. This should give you the angle of a vector around the z-Axis for example (un-tested):

var vector = transform.direction;
var angle : float = Mathf.Atan2(vector.x, vector.z) * Mathf.Rad2Deg;
Comment
Add comment · Show 1 · 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 Jade · Jan 26, 2011 at 03:28 AM 0
Share

I just could not get this to work. I tried multiple directions (up forward, right) and every combination of x,y x,z y,x y,z, z,x z,y for each direction. Nothing led me to a value that linearly worked on the x axis. All values that changed with x rotations also changed with z rotations.

avatar image
0

Answer by Jade · Jan 26, 2011 at 03:33 AM

I ended up just reorienting my object so that 90 degrees (y-axis) wasn't within the range of readings that I needed (I'm using forward for the primary direction instead of up now). I wouldn't call this an answer, but a workaround. I'd still like to know why this happens, but I also need to move on due to tight deadlines!

Thanks for all of the replies, and if you have more info, I'd love to hear it!

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

1 Person is following this question.

avatar image

Related Questions

Need a little help with quick angle equation 2 Answers

Euler angle rotation in self space problem. 1 Answer

rotate slowly! 1 Answer

Tilt character when rotating 0 Answers

How to turn a single eulerAngle measurement of a moving game object into a variable? 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