Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by dhaas · Sep 04, 2015 at 09:14 PM · rotationplayertutorialcubespace shooter

Why Does My Cube Player rotate 180 degrees when I start My game?

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!

Thanks!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Vice_Versa · Sep 04, 2015 at 09:29 PM

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;

 void Start()
 {
  Vector3 temp = transform.rotation.eulerAngles;
  temp.y = myY;
 temp.z = myZ;
  transform.rotation = Quaternion.Euler(temp);
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by dhaas · Sep 08, 2015 at 02:00 PM

@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.. alt text

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!

alt text


screen-shot-2015-09-08-at-94437-am.png (198.5 kB)
screen-shot-2015-09-08-at-95648-am.png (204.7 kB)
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image dhaas · Sep 08, 2015 at 05:13 PM 0
Share

I found the solve here:

http://answers.unity3d.com/questions/278881/how-to-change-rotation-through-script.html

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

30 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I stop my cube from rotating when it hits the ground ? 0 Answers

Why is my Player game object not rotating with mouse movement in 'Survival Shooter' unity project 10 Answers

My script does not work each time i enter Unity unless i add it to the object again. any solutions? 0 Answers

[C#] Rotate player to camera forward look 0 Answers

How can I make the camera not overreach a limit of rotation one axis. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges