bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.42k stars 3.59k forks source link

Add synonyms for transform relative vectors #1663

Closed alice-i-cecile closed 3 years ago

alice-i-cecile commented 3 years ago

What problem does this solve or what need does it fill?

Clearly communicates to users (and readers of code) how to point in various directions.

What solution would you like?

Add synonyms for local_x etc as left...

What alternative(s) have you considered?

Clearly document which direction the local_* directions point to. This is only a partial solution though, because the code is still much more challenging to read.

Additional context

Godot uses the same coordinate system and implements the constants linked here that we should borrow convention from.

Partial fix of #501.

Tried and failed in #1300 due to confusion; noticed in #1465 and corrected in #1476.

runfalk commented 3 years ago

The thing is that these names only make sense if your camera is mounted on the Y-axis. I have a project where I mostly care about the XY position of things and have chosen a Z-oriented camera, so I lay out my entities in the XY plane. I found this image when looking for what other engines do, and it seems to be very split: https://www.techarthub.com/wp-content/uploads/coordinate-comparison-chart-full.jpg.

Do we want to force the decision of whether Y or Z is up?

mockersf commented 3 years ago

Bevy is right-handed y-up

from https://discord.com/channels/691052431525675048/743663924229963868/793179969806270515:

You're welcome to keeping thinking about it / discussing. You will just have a hard time convincing me to change things. This is the decision making process I used:

  • 2d and 3d should be consistent for simplicity and to support 2.5d scenarios nicely
  • Y-up makes the most sense in 2d. "up" in 3d is way more divisive, so it matters less. Therefore Y should be up.
  • Right handed lends itself nicely to z-index expectations in 2d (increasing z indices go out of the screen / are more "in front")
  • Right handed aligns nicely with math users' expectations