summaryrefslogtreecommitdiff
path: root/game/vehicles/railVehicleClass.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-11-16 00:07:48 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-11-16 00:07:48 +0000
commitb7fadd730a78671a0eaf55c36df24c04661ef2c3 (patch)
treea9d5bce62b3c6e42008d7e0f637665aa97b73764 /game/vehicles/railVehicleClass.cpp
parentDon't write null value for pointers (diff)
downloadilt-b7fadd730a78671a0eaf55c36df24c04661ef2c3.tar.bz2
ilt-b7fadd730a78671a0eaf55c36df24c04661ef2c3.tar.xz
ilt-b7fadd730a78671a0eaf55c36df24c04661ef2c3.zip
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.
Diffstat (limited to 'game/vehicles/railVehicleClass.cpp')
-rw-r--r--game/vehicles/railVehicleClass.cpp8
1 files changed, 4 insertions, 4 deletions
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<std::pair<float, int>> 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;
}