# Proper X Rotation Angle Detection.

 0 Hellow, I need the be able to read the proper angle of my object. But when I read it from Unity in my script, (the reading part of the script) ``````AngleX = transform.eulerAngles.x; `````` It read it quite awkwardly, It goes from 360(0) to 270, then from 270 to 360(0), then from 360(0) to 90, then from 90 to 360(0). That's readings I get, on a SINGLE full rotation. Edit: Here a video http://www.megaupload.com/?d=WIEMPF70 Youtube for the ones who do not want to download a file. http://www.youtube.com/watch?v=gfTcPG7Nfd4 Just look the X Angle value in the inpsector, and you'll probably understand. more ▼ asked Oct 18 '10 at 08:10 PM Oninji 332 ● 43 ● 47 ● 50 This description makes little to no sense. What is a "proper angle"? What do those values mean? What are you doing when you get those values? It's next to impossible to answer a question that doesn't make sense and, while it is apparent that your English is very poor, could you please rephrase the question into something clearer? Oct 18 '10 at 08:40 PM skovacs1 Also, try using Transform.localEulerAngles.x and post back if it helps or not, and if it's closer to what you would expect to see. Oct 18 '10 at 09:16 PM Cyb3rManiak The big itself does little sense. It is as I say, What the X rotation reading return isn't the angle of the object On screen. Oct 18 '10 at 09:40 PM Oninji Added a video, and local or not it doesn't work better. Oct 18 '10 at 09:41 PM Oninji add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

 0 This has to do with the way unity converts its native rotations (Quaternions) to Euler Angles (Vector3). If you look at the transform in the inspector, the Y and Z rotations are changing when you hit certain points to compensate for the conversion. If I were you, I'd look into having a function that relies on Mathf.Angle and not Quaternion to Euler conversion (mostly because I am afraid of Quaternions) more ▼ answered Oct 18 '10 at 10:21 PM Adam Rademacher 1.1k ● 1 ● 3 ● 19 Well, when on another object I use this on the Y angle, and there's no error with the Y rotation. It's only the X rotation.I'm currently working on a way to make rotation dependant of a variable as an alternative, and so I could check on the Variable instead.Meanwhile, I'll also check if there's an alternative using Mathf, but I'm not sure, but well it's worth a shot.If I could find a way to get reading of the object "True Rotation Angle" it would be truly the most simple way. Oct 18 '10 at 10:30 PM Oninji It's neither a bug nor an error. Also, there isn't a 'true rotation angle' as far as Euler angles are concerned. If you want the pitch/elevation angle to be computed in a certain way though, you can store and update the rotation angles yourself and then build the orientation directly from them, or you can compute the angles from the direction vectors using trig, Oct 19 '10 at 05:53 AM Jesse Anders add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

By Email:

Topics:

x3461
x2168
x287

asked: Oct 18 '10 at 08:10 PM

Seen: 3345 times

Last Updated: Oct 18 '10 at 10:12 PM