From b7fadd730a78671a0eaf55c36df24c04661ef2c3 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 16 Nov 2021 00:07:48 +0000 Subject: Swap y,z axis This was a pain... but all the coords make much more sense now and a lot of mystery negation has disappeared. --- game/vehicles/railVehicle.cpp | 2 +- game/vehicles/railVehicleClass.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'game/vehicles') diff --git a/game/vehicles/railVehicle.cpp b/game/vehicles/railVehicle.cpp index a2373e7..aea7f8c 100644 --- a/game/vehicles/railVehicle.cpp +++ b/game/vehicles/railVehicle.cpp @@ -21,6 +21,6 @@ RailVehicle::move(const Train * t, float & trailBy) const auto & b2Pos = bogies[1] = t->getBogiePosition(t->linkDist, trailBy += rvClass->wheelBase); const auto diff = glm::normalize(b2Pos.pos - b1Pos.pos); location.pos = (b1Pos.pos + b2Pos.pos) / 2.F; - location.rot = {-vector_pitch(diff), vector_yaw(diff), 0}; + location.rot = {vector_pitch(diff), vector_yaw(diff), 0}; trailBy += 0.6F + overhang; } diff --git a/game/vehicles/railVehicleClass.cpp b/game/vehicles/railVehicleClass.cpp index 83eb9a0..52b7dbe 100644 --- a/game/vehicles/railVehicleClass.cpp +++ b/game/vehicles/railVehicleClass.cpp @@ -60,12 +60,12 @@ RailVehicleClass::bogieOffset(ObjParser & o) std::set> vertexIds; for (const auto & face : object.second) { for (const auto & faceElement : face) { - vertexIds.emplace(o.vertices[faceElement.x - 1].z, faceElement.x - 1); + vertexIds.emplace(o.vertices[faceElement.x - 1].y, faceElement.x - 1); } } const auto offset = (vertexIds.begin()->first + vertexIds.rbegin()->first) / 2; for (const auto & v : vertexIds) { - o.vertices[v.second].z -= offset; + o.vertices[v.second].y -= offset; } wheelBase += std::abs(offset); } @@ -76,7 +76,7 @@ float RailVehicleClass::objectLength(ObjParser & o) { const auto mme = std::minmax_element(o.vertices.begin(), o.vertices.end(), [](const auto & v1, const auto & v2) { - return v1.z < v2.z; + return v1.y < v2.y; }); - return mme.second->z - mme.first->z; + return mme.second->y - mme.first->y; } -- cgit v1.2.3