I followed the beginner space shooter tutorial and I wanted to adjust the project to have my own assets. I want the Player to be a flat image (and probably the asteroids too) so I made a cube and used an image as the texture. So far everything is working still as far as game functionality but my image is showing up ‘flipped’ both horizontally and vertically. I want my cube to be rotated 180 degrees. I tried changing the rotation y and z to 180 in the inspector and that makes the game and scene view look correct but when I start the game those changes to the inspector default back to 0.
Basically I need to rotate my ‘cube’ player 180 degrees to face the oncoming asteroids.
If someone could help me that would be awesome!
hmm. from the sound of it, you have something in one of your scripts that are setting the players rotation to 0. what you can do through script is
float myY = 180f;
float myZ = 180f;
Vector3 temp = transform.rotation.eulerAngles;
temp.y = myY;
temp.z = myZ;
transform.rotation = Quaternion.Euler(temp);
@Vice_Versa Thanks so much for your response.
I’m not sure I know where to put this exactly. I tried to just add that code above my void update on my PlayerController script and close the bracket and added two int variables myY and myZ and set them to 180 but that didn’t work. I feel like there may be a simpler way to do change the rotation but I’m not sure how.
Here is what my code looks like now for the player…
And then here it is with your code I tried to add. Let me know if you know what I’m doing wrong! Thanks so much!