bevy_xpbd
bevy_xpbd copied to clipboard
inverted sign wastes hours of girls life
the -= there
WHY
wasted hours of my life after copying this code and trying to figure out why my first person character controller was all fucked up
this is my fault for writing code and just not really being fully mentally present, probably, but i just want to know why. why.
did you somehow place the camera in a weird position and the movement didnt look right so you inverted the sign? why.
please fix this. i dont know what you would have to do to fix this. if you put the camera on the opposite side i'm pretty sure it would fuck up the horizontal movement instead of the vertical movement??? so idk what you have to do to fix this or WHY its like this but please please please fix this
Unfortunately, this isn't really something I can fix. The sign is negative there because of Bevy's right-handed Y-up coordinate system. In Bevy, +Z is "pointing towards the screen", while "forward" is -Z, which you can see from Transform::forward
:
pub fn forward(&self) -> Direction3d {
-self.local_z()
}
There's a lot of reasons why Bevy uses this coordinate system, and it's also consistent with e.g. Godot and a lot of other tools. Cart (the lead dev of Bevy) has some reasons listed here: bevyengine/bevy#10488
Here's also Freya's chart on coordinate systems: (copied from the discussion)
(Unreal sitting alone in the corner lol)
yeah, i cant really think of any sort of thing that would fix it, maybe the best thing to do would be to simply add a comment next to the code to point out the inverted sign?
Inverse left and right buttons... The inversion has to happen, but it should happen in player local coordinate system, not world coordinate system