I have made a 3d controllable camera and I have a player model that follows the y and z rotations but not the x so my player doesn’t tilt up and down and it works great but when you look left or right 180 degrees the model flips over. I’ve spent the last 2 hours trying to figure out a way to stop if anyone has an idea let me now.
This happens because a rotation of a model is in a matrix and getting euler angles from it are generally restricted between -180 to 180. When an axis is set beyond that, the representation of orientation can be represented by other axis ‘flipping’.
See video:
Because you are using the Z euler angle from the entity rather than storing your own, it and the X axis will flip from 0 to 180 once the Y angle goes beyond 180.
Hi @WilliamBoersma31! Please use the code highlight format if you want to use some code in your post. This will keep your post including your code easy to read.
yeah but it rotates it every frame I need it to match the rotation of the camera holder. Is there any other way to ignore the matrix and just rotate more than 180 degrees?
and it kind of worked it stopped flipping over and looked the right way but when you look around it would just have a stroke. is there any other way to bypass the rotation matrix?
hey I decided to settle for just parenting the model to the rotater this has taken way more of my time than I would have liked I may come back to it in the future but for now I’m done
Yes, I’m just showing how to do if you didn’t want it to be parented (ie you don’t want the entity to be affected by the rotater scale and position for instance)