And an event to change the rotationx variable then.
if (Input.GetAxis("Vertical")>0){
rotationx=rotationx+1;
}
if (Input.GetAxis("Vertical")<0){
rotationx=rotationx-1;
}
So when i press up the object rotates downwards, and when i press down the object rotates upwards. So far so good.
First problem, the Y and Z axis changes all the time by odd values too. How comes? I just manipulate X.
Second problem, at reaching 270 degrees and 90 degrees the whole stuff starts to flicker. Further experiments shows me that the X axis refuses to turn the full 360 degrees. It rotates back in opposite direction instead.
How can i work around this problems? All i want to do is to rotate around the local axis. This is really a challenge in Unity …
The scripting reference mentions that incrementing a single axis isn’t a good idea, basically for the reasons you’ve encountered.
If you can change your script to use Rotate or update all axis simultaneously and clamp your rotation values manually you’ll probably get more stable results.
Well, I ended in manipulating in single axis because transform.rotate gives other odd results. I cannot manage to stop it to rotate around the wrong angles. A conflict between local and global i guess. But am not sure. It has its own mind. And i ended in using transform.rotate because using physics gaves the most odd results. Which closes the circle. I initially ended in using physics because i haven`t found a single explanation or tutorial that explains how to rotate the single axis. After i tried transform.rotate first of course
Hm, maybe it`s also no good idea to move and rotate my objects at all :lol:
See my problem, hehe?
I simply need to manipulate the single axis to rebuild a little non physics based flightsim. Ive done it in 3DGS before, i want to redo it in Unity. Its my little learning project to find out all about movement and rotation. Local, Global, combined with movement and input.
Its unfortunately harder than thought. No special tutorial for that available. Extracting the infos from other scripts is very hard and cumbersome, because i lack the basics, the stuff i wanted to learn by this. And everytime i read a forum thread about it, this forum thread ends like your answer: Dont do it this way. Which is not really helpful honestly. Even when meant with good will
I wouldn`t mind to find a useful example that uses transform.rotate neither. And i would even happier to have a working example that uses physics
Maybe somebody could be so kind enough to make a tutorial that just covers object manipulation around movement and rotation? That would really be great