Different camera coordinate system #11632
-
Hi, I have a Bevy app which interacts with a system which is -Y (yep negative) up and +Z forward. I cannot change that system's coordinate system. Having different systems has been a source of problems. Does anyone have any advice for how to achieve this in Bevy? I saw the cheatbook had a suggestion: https://bevy-cheatbook.github.io/cookbook/custom-projection.html but that's from 0.9. Hoping someone has tried similar things. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Unfortunately I think your best bet is to take the example you linked and use the migration guides if any issues pop up |
Beta Was this translation helpful? Give feedback.
-
Was thinking a bit more about it. Since the two coordinate systems I'm using are of the same handedness, I think perhaps if I let the external coordinate system be a parent of the camera, I can just add a rotation in the child (the Bevy camera transform) such that they align... I'll test it out. |
Beta Was this translation helpful? Give feedback.
I ended up realizing that a camera in Bevy is a bit strange (at least intuitively).
The confusing part of this image for me is that a camera's transform adheres to this image.
In other words, if you use gizmos and plot the local x, local y, local z of camera with no rotation and some translation, it will align the the world XYZ like you'd expect.
But the way the camera is looking is not the same thing. So the transform and its rotation does one thing, and the way the camera is looking is another (that is called forward, and is towards local negative Z).
Anyway I solved this for myself by using the external program's coordinate system, right handed XYZ with -Y up.
I apply transforms inclu…