So… I am working on an flight simulator and as I tried to implemend the first-person-view I wrote this scipt. I wanted that you can see 90 deg to your left and right and up and down. to me it looks like I’ve done the exact same thing for the y axis as for the x but as it seem I haven’t.
Hey and welcome.
Generally speaking it’s a good idea to mention what is not working. Are you getting errors? What is the expected behavior? What is the desired behavior? More information is always good.
One thing i see at first glance is that you set localRotation to something, then set it to something else. The first assignment (line 28) is pointless, since the other assignment (line 29) simply overwrites it. So you’d most likely want to fix that by putting both xRotation and yRotation in the same Quaternion.Euler(…).
I’m so glad that you made me aware of this error! Ihad no errors in the consol what made me didn’t think about that. Thanks for the answer otherwise I probably would have sit here for hours
I thought maybe someone could need the script so here is the optimized version: