- Home /
Rotation Y axis is bugged.
I am having a problem with how to move my door.
As you can see by my door's odd position whenever I set my rotation of my door, in this case to open Unity makes the door move or spin in the wrong direction.
Another issue is the Rotation at the Y axis. Whenever I set it to -90 it changes it to 270 all of a sudden when I play. The Door HAS to open like a regular door but it keep making loops around as you can see in the photo.
So guys any solutions for this? I am all ears thanks in advance for any help! :)
Shindy
It would be easier to solve your problem, if you could share the code snippet that you are using to rotate your door.
I am using the Animation tool to rotate it not a script. As you can see on the right hand side my doors Y coordinates change from -90 to 270 for some strange reason.
270 and -90 are the same, are they not? If you set an object to -90 rotation or 270, they will be the same rotation.
Answer by ScaniX · Sep 02, 2016 at 11:56 PM
Just tested this, and you are right: Unity auto "corrects" the value to 270 if entered in the inspector.
What works is a value entered in the animation view. Either expand the Rotation element of the transform in the Dopesheet and enter the value there or switch to Curves, select the corresponding point of the animation curve (which is probably just a line in your case), right click and select "Edit keys...". If you enter the value of -90 this way, Unity will keep it like that.
I ended up redoing my animation key frames till the door moved in the right direction. Haha it was driving me nuts.
Answer by cezikmertcan · Sep 02, 2016 at 11:42 PM
Okay lets calculate what you have done so far
-90 to 270 is actually a 360
(-90)-(270)=-360 which is 360 at the same time.
You are getting loop because actually you made a perfect loop.
Here is how you can solve it
Normally an opening door goes minimum 90 maximum 180 degrees. So if its original y rotation is -90 you should make the stop rotation like these
-90 --> 0 is 90
-90 --> 90 is 180
So you could go for 0 or 90 for the last rotation key.
Yeah thanks I ended up re-doing my animations and FINALLY unity caught on. The door is suppose to open at -90 degrees cause when it does it opens like a regular door. I had to keep redoing my animations and look at it frame by frame till I fixed it. One guy in the comment section said he tested it and he noticed this too.