Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
14
Question by ina · Dec 20, 2010 at 02:17 AM · mathvectorcoordinate-systemtheory

Unity is a Left-Handed Coordinate System? Why?

I just noticed the unity default axis is a left-handed coordinate system. Interesting.

This would explain for some interesting sign conventions in various cross-product as well as cross-product quantities -- torque/moment of inertia, angular velocity.

My question then is: why is Unity a left-handed coordinate system? Are there design, performance, or other benefits for this? Why not a right-handed system (OpenGL is right-handed..)

Comment
Add comment · Show 13
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 Jesse Anders · Dec 20, 2010 at 02:34 AM 2
Share

That's more of an observation than a question :) But yes, Unity uses a left-handed coordinate system.

avatar image Jessy · Dec 20, 2010 at 03:29 AM 2
Share

Unity is a game engine and not a modeling app. You're often thinking of things in the engine as active characters, ins$$anonymous$$d of as things that you are observing, as the creator. The concept of hands doesn't help understand this; ins$$anonymous$$d, think of eyes.

avatar image _Petroz · Dec 20, 2010 at 06:02 AM 0
Share

If only there was a place for this: 'unityObservations?'

avatar image ina · Dec 20, 2010 at 07:17 AM 0
Share

well, this explains for the interesting sign convention in cross products -- torque/moment of inertia, that sort of stuff..

avatar image Mike 3 · Dec 20, 2010 at 08:06 AM 3
Share

It's not like there's a standard. OpenGL uses right handed, DirectX uses left handed. $$anonymous$$odelling apps are split between the two.

Show more comments

5 Replies

· Add your reply
  • Sort: 
avatar image
11

Answer by Jesse Anders · Dec 20, 2010 at 06:00 PM

To reinforce what's already been said, there is no standard with respect to coordinate-system handedness in games and graphics; neither left-handed nor right-handed is more standard or 'correct' than the other.

There's a common misconception that Direct3D is left-handed and OpenGL is right-handed, but that's not actually true (not to the best of my knowledge at least). The two APIs are usually presented that way in references and tutorials, but you can easily use either handedness with either API. The DirectX math library offers both right- and left-handed versions of all functions for which handedness matters, and as for OpenGL, the option of uploading your own transform matrices has been available since the earliest versions of the API (and in newer versions of OpenGL, even the few convenience functions that used a right-handed system have been deprecated or removed, as I understand it).

As for the cross product (for example), note that it does not differ mathematically between left- and right-handed coordinate systems. The result may differ when visualized, but mathematically the operation is the same.

To respond to Jessy's comment above:

Unity was made by Western people. The convention for such people is that right is the positive direction. Put that together with what I said above; when you think left-to-right, then X being positive from the vantage point of the game object (which is often a character or camera), is the way to go.

Despite the fact that OpenGL doesn't actually enforce a specific handedness, just about every OpenGL reference and tutorial ever created uses a right-handed system, so apparently it's not quite so clear that left-handed is 'the way to go' (if that's what you're implying).

Also, view space is only one of many spaces that may be of interest to developers. For example, in some contexts a right-handed system with +z up may be preferred because this results in the standard Cartesian XY coordinate system corresponding to the ground plane and z increasing with altitude. Other APIs (such as the Unreal engine) use a left-handed system, but with +z up rather than +y. There are many different conventions that are commonly used, and none of them is more 'correct' than the others (although certain conventions certainly may seem more correct to some as a result of the individual's background and personal preference).

Comment
Add comment · Show 3 · 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 Bunny83 · Sep 02, 2012 at 11:21 AM 0
Share

@Fattie: Regarding your PS: The XY plane in front of you and z goes into the distance is... left-handed :D In a right-handed system z goes towards you, like in OpenGL (I know you can change it, but OpenGL is initialized right-handed, the mathematical way ;) )

avatar image Wolfram · Sep 02, 2012 at 12:18 PM 1
Share

Actually, many if not most modelling programs use Z-up (for example 3D$$anonymous$$ax and Blender), while many rendering engines stick to Y-up. As with right and left handedness, there is no absolute standard that everyone adheres to. There are 6 possible rudimentary permutations (left/right times X/Y/Z up), and so there even might be some ridiculous software that uses X as an up vector. $$anonymous$$ost other softwares use any of the remaining 4 permutations, probably subdivided into even more subconcepts (+Z is front, -Z is front, +X is front, ...).

avatar image Bunny83 · Sep 02, 2012 at 12:34 PM 0
Share

There are even optimisations depending on the type of game. For example a game like warcraft or C&C all movement happens on the ground plane. It's more natural to have x-y on flat on the ground and z up (or down). Next thing is AABB testing. You usually test each axis seperately you should test those axis first which are more likely to move. So in a C&C game you would test z at last.

Depending on the engine implementation, which can't be changed, you might just want to flip your world by 90° and you get a slightly improved AABB testing x)

The way the models are created and the way they are displayed / imported should also be seperated. Unity and/or the modelling app already convert the model during export / import. However, a little bit more control over that procedure would be nice ;)

avatar image
8

Answer by AmazingFactory · Feb 21, 2012 at 01:15 AM

Maths = Right Handed Physics = Right Handed OpenGL = Right Handed XNA = Right Handed

DirectX = Left Handed // well only cube map sampling is hard coded to left handed Unity = Left Handed // and not configurable

Right handed (or configurable) would be the smart choice.

Comment
Add comment · Show 3 · 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 ina · Feb 21, 2012 at 08:36 AM 0
Share

Hmm afaik Unity's entire coordinate system is left handed

avatar image AmazingFactory · Feb 21, 2012 at 10:00 AM 0
Share

I hope so! I wish they used Radians consistently ... you have to double check every "angle" parameter. After 7 days of evaluating Unity I think it is quicker to write the game using SlimDX or XNA. Unity is proving more of a hindrance than a help (if you are a programmer anyway) The API is a mess.

avatar image Fattie · Sep 02, 2012 at 09:24 AM 2
Share

right, the radians/degrees thing is as silly

avatar image
6

Answer by Paulius-Liekis · Dec 20, 2010 at 09:16 AM

Neither left-handed or right-handed is a standard, so there is nothing wrong in Unity using left-handed.

Comment
Add comment · 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 ina · Dec 20, 2010 at 12:09 PM 9
Share

i come from orthodox physics. everything is right-handed. so i guess it was surprising to find that unity is left-handed

avatar image syclamoth · Oct 25, 2011 at 12:02 AM 1
Share

You hear that? Real life uses right-handed coordinates! Take that, standards.

avatar image Fattie · Sep 02, 2012 at 09:06 AM 0
Share

On this point, Ina is correct and Paulus is wrong. Battle of the votes! :)

avatar image hogdotmac · Jan 29, 2019 at 11:10 PM 0
Share

not having standards is wrong

avatar image Eric5h5 hogdotmac · Jan 30, 2019 at 12:01 AM 1
Share

Pointless comment. There are standards, of course, just more than one. https://xkcd.com/927/

avatar image
3

Answer by FrojoS · Aug 22, 2012 at 01:51 PM

I have a really stupid question: Where is the documentation for the Unity3D coordinate system convention?

Ideally, I would like to have an official document, that I can cite in a technical report, which contains:

  • coordinate system: left handed

  • gravity convention: in which direction is gravity pointing? Seems like its negative y.

  • Euler Angles: which order of rotation (there are 64 different possibilities!). Seems like its Kardan, with z -> y -> x, all counter clockwise.

  • Quaternions: Is w rotating clock wise or counterclockwise around the xyz vector?

  • Units: SI? Seems like the unit translation is ment to be 1 meter.

Comment
Add comment · Show 4 · 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 Eric5h5 · Sep 02, 2012 at 04:12 PM 0
Share

Gravity points in whatever direction you tell it to. Units are whatever you say they are.

avatar image Bunny83 · Sep 02, 2012 at 05:27 PM 0
Share

Yes, basically you can scale the units as you wish, but some things force a special orientation / scale. Gravity can of course point in any direction, that's why we can change the vector. But afaik the CharacterController for example can't be rotated. Also Physics simulation is calculated on the basis of 1u == 1m.

However, most of this is documented. Sometimes nor where you would expect it. The documentation is a but messy, but most information is there like eulerangles multiplication order and the recommended unit scale.

avatar image Eric5h5 · Sep 02, 2012 at 05:42 PM 1
Share

The documentation folder is around 200$$anonymous$$B as of Unity 3.5 (and 350+$$anonymous$$B currently for Unity 4). There's a huge amount of information available if you care to read it. It's not always organized optimally, and some functionality is under-documented (occasionally to the point of having no real info, which is annoying to be sure), but clai$$anonymous$$g Unity is "essentially undocumented" is disingenuous at best.

avatar image by0log1c · Sep 02, 2012 at 07:32 PM 2
Share

Stop whining, Unity has more actually useful docs than all of the (few) engines/framework I've used. I agree I'm not as advanced as you guys and even I will sometimes have difficulty finding the exact info I'm looking for, but I always do, quickly - now try this with Unreal3.

avatar image
2

Answer by Ming · Oct 25, 2011 at 12:01 AM

If you are right-handed, then the front-side of a triangle should also be right-handed. That is, the vertices (0, 1, 2) should wind counter-clockwise. Why? If you take Vector01 X Vector02, you get the normal which determines the front of the face for front-facing/back-facing checks. If you are left-handed, the non-commutative cross product becomes Vector02 X Vector01 to get the normal.

If you add the UVs to the triangle, I would prefer the U to go along positive X and V to go along positive Y. This leads to a right-handed coordinate system to produce a non-mirrored image.

I believe that this coordination between 2D and 3D elements makes right-handed preferred over left-handed. Additionally, physics are typically done in right-handed systems which further adds to the preference.

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

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

13 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

Related Questions

Math Optimization: Normalize 2 Answers

Converting an Azimuthal Coordinate to Vector3D? 1 Answer

Check if position is inside area? 2 Answers

More simple vector math... 2 Answers

How to get up vector of rotation? 1 Answer


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