summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-02-14 14:04:16 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-02-14 14:04:16 +0000
commit43476681748a14797409dbaf8e950613385a233f (patch)
treecd7b9bc0ac524e836fa16568cc588e34f493ddd3
parentAdd vector pitch (diff)
downloadilt-43476681748a14797409dbaf8e950613385a233f.tar.bz2
ilt-43476681748a14797409dbaf8e950613385a233f.tar.xz
ilt-43476681748a14797409dbaf8e950613385a233f.zip
Fix vertical offset of curved rails
-rw-r--r--game/network/rail.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/game/network/rail.cpp b/game/network/rail.cpp
index 7c045ad..3b31204 100644
--- a/game/network/rail.cpp
+++ b/game/network/rail.cpp
@@ -125,7 +125,7 @@ RailLinkCurve::RailLinkCurve(const NodePtr & a, const NodePtr & b, glm::vec3 c,
int segCount = segs;
vertices.reserve((segCount + 1) * railCrossSection.size());
indices.reserve(segCount * 2 * railCrossSection.size());
- for (glm::vec3 swing = {arc.second, -e1p.y, 0.F}; segCount >= 0; swing += step, --segCount) {
+ for (glm::vec3 swing = {arc.second, e1p.y - centreBase.y, 0.F}; segCount >= 0; swing += step, --segCount) {
const auto t {trans * glm::rotate(half_pi - swing.x, up) * glm::translate(glm::vec3 {radius, swing.y, 0.F})};
for (const auto & rcs : railCrossSection) {
const glm::vec3 m {(t * glm::vec4 {rcs.first, 1})};