• 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 /
avatar image
Question by curv · Jan 11, 2013 at 04:52 PM · 2dex2d

2D rotation through z??

Hi there

I'm creating a 2d game and have made all the correct setup (or at least I think I have). Using orthographic camera etc..

I am transforming my sprite on click, but having to do it through Z. Can someone explain to me why Z and not X.

transform.Rotate(0,0,-90)

edit: sorry forgot yo mention i am using ex2d not sure if that's relevant though

Comment

People who like this

0 Show 0
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

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Lovrenc · Jan 11, 2013 at 05:55 PM

Well in unity Z is forward axis. Thats it. It's just the way they inplemented coordinate system.

Z - forward
Y - up
X - right (or left? not sure)

Comment

People who like this

0 Show 5 · 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 curv · Jan 11, 2013 at 05:58 PM 0
Share

So my setup isn't wrong then, this is just Unity design?

avatar image $$anonymous$$ · Jan 11, 2013 at 05:59 PM 0
Share

even if you create a 2D game, Unity is 3D. If your scene is set up in a way that your left/right is on X and your up/down is on Y, "2D" rotation is around Z. You can see that if you look at the axis gizmo in the scene view.

avatar image Lovrenc · Jan 11, 2013 at 06:02 PM 0
Share

Well you could arrange your scene to work in X/Y fashion, but i would not recomend it as it would break synergy with unity builtin functions and would have to correct/predict/remember a lot of things to keep the game working.

avatar image $$anonymous$$ · Jan 11, 2013 at 06:09 PM 0
Share

btw I don't really understand the question. It can only be Z in this case, that's how the math works. If it's strange to you that you're using a third axis in a 2D game, well.. if you wanted to achieve the same rotation in a 2D sheet of a coordinate system, you would stick an imaginary needle through the sheet so it's sticking out of it perpendicularly, and you would rotate your 2D object around that.. the needle is the Z axis, if this helps. It's not necessarily Unity's design, it's math.

avatar image curv · Jan 11, 2013 at 06:20 PM 0
Share

No this makes sense, thanks guys.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

9 People are following this question.

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

Related Questions

2D Animation does not start 1 Answer

Best way to equip a 2D character? 1 Answer

Idle animation not working 0 Answers

Assets/Scripts/PlayerController.cs(32,49): error CS0126: An object of a type convertible to `float' is required for the return statement 1 Answer

Instantiate after setting values? 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