diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-11-16 00:07:48 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-11-16 00:07:48 +0000 |
commit | b7fadd730a78671a0eaf55c36df24c04661ef2c3 (patch) | |
tree | a9d5bce62b3c6e42008d7e0f637665aa97b73764 /game/network/link.cpp | |
parent | Don't write null value for pointers (diff) | |
download | ilt-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/network/link.cpp')
-rw-r--r-- | game/network/link.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/game/network/link.cpp b/game/network/link.cpp index e45126f..f3a79a6 100644 --- a/game/network/link.cpp +++ b/game/network/link.cpp @@ -12,7 +12,7 @@ bool operator<(const glm::vec3 & a, const glm::vec3 & b) { // NOLINTNEXTLINE(hicpp-use-nullptr,modernize-use-nullptr) - return std::tie(a.x, a.z, a.y) < std::tie(b.x, b.z, b.y); + return std::tie(a.x, a.y, a.z) < std::tie(b.x, b.y, b.z); } bool @@ -27,7 +27,7 @@ LinkStraight::positionAt(float dist, unsigned char start) const const auto es {std::make_pair(ends[start].node.get(), ends[1 - start].node.get())}; const auto diff {es.second->pos - es.first->pos}; const auto dir {glm::normalize(diff)}; - return Location {es.first->pos + vehiclePositionOffset() + dir * dist, {-vector_pitch(dir), vector_yaw(dir), 0}}; + return Location {es.first->pos + vehiclePositionOffset() + dir * dist, {vector_pitch(dir), vector_yaw(dir), 0}}; } Location @@ -40,7 +40,7 @@ LinkCurve::positionAt(float dist, unsigned char start) const const auto ang {as.first + ((as.second - as.first) * frac)}; const auto relPos {!sincosf(ang) * radius}; const auto relClimb {vehiclePositionOffset() - + glm::vec3 {0, -centreBase.y + es.first->pos.y + ((es.second->pos.y - es.first->pos.y) * frac), 0}}; - const auto pitch {vector_pitch({0, (es.first->pos.y - es.second->pos.y) / length, 0})}; + + glm::vec3 {0, 0, es.first->pos.z - centreBase.z + ((es.second->pos.z - es.first->pos.z) * frac)}}; + const auto pitch {vector_pitch({0, 0, (es.second->pos.z - es.first->pos.z) / length})}; return Location {relPos + relClimb + centreBase, {pitch, normalize(ang + dirOffset[start]), 0}}; } |