18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 22:44:59 +01:00

fix(camera): the roll of the cab shake tilts the view about the line of sight again (#414)

623c4f82 (#97, in 26.05.1) changed the order of the camera rotations from
Z, X, Y to X, Y, Z. The order matters only with a roll, which the cab
shake gives (Angle.z, set in drivermode.cpp), or a camera entry of the
scenery with a roll. Applied last, in the
space of the cab, the roll nodded the view up and down when looking out
of a side window instead of tilting it. The roll is multiplied in first
again, as in 26.05.

Co-authored-by: maj00r <maj00r@host>
This commit is contained in:
maj00r
2026-11-19 05:24:28 +01:00
committed by GitHub
parent 267d5b3a8f
commit 8bda0275f3

View File

@@ -192,9 +192,12 @@ void TCamera::Update()
bool TCamera::SetMatrix( glm::dmat4 &Matrix ) const {
// the roll (z) is multiplied in first, so it acts last, about the line of sight: the sway of the cab tilts the view
// the same way wherever the head is turned, as it did in 26.05. the order matters only with a roll (the cab shake,
// or the angles of a camera entry of the scenery)
Matrix = glm::rotate(Matrix, -(double)Angle.z, glm::dvec3(0, 0, 1)); // po wyłączeniu tego kręci się pojazd, a sceneria nie
Matrix = glm::rotate(Matrix, -(double)Angle.x, glm::dvec3(1, 0, 0));
Matrix = glm::rotate(Matrix, -(double)Angle.y, glm::dvec3(0, 1, 0)); // w zewnętrznym widoku: kierunek patrzenia
Matrix = glm::rotate(Matrix, -(double)Angle.z, glm::dvec3(0, 0, 1)); // po wyłączeniu tego kręci się pojazd, a sceneria nie
if( m_owner != nullptr && false == DebugCameraFlag ) {