aboutsummaryrefslogtreecommitdiff
path: root/advtrains/helpers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains/helpers.lua')
-rw-r--r--advtrains/helpers.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/advtrains/helpers.lua b/advtrains/helpers.lua
index e060920..ce059de 100644
--- a/advtrains/helpers.lua
+++ b/advtrains/helpers.lua
@@ -37,7 +37,7 @@ advtrains.pos_add_dir = advtrains.dirCoordSet
function advtrains.pos_add_angle(pos, ang)
-- 0 is +Z -> meaning of sin/cos swapped
- return vector.add(pos, {x = -math.cos(ang), y = 0, z = math.sin(ang)})
+ return vector.add(pos, {x = -math.sin(ang), y = 0, z = math.cos(ang)})
end
function advtrains.dirToCoord(dir)
@@ -103,7 +103,7 @@ function advtrains.yawToClosestConn(yaw, conns)
local min_connid, min_diff=1, 10
for connid, conn in ipairs(conns) do
local yaw1 = advtrains.dir_to_angle(conn.c)
- local diff = advtrains.minAngleDiffRad(yaw, yaw1)
+ local diff = math.abs(advtrains.minAngleDiffRad(yaw, yaw1))
if diff < min_diff then
min_connid = connid
min_diff = diff