diff options
author | orwell96 <orwell@bleipb.de> | 2018-05-29 12:27:02 +0200 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2018-06-14 17:39:42 +0200 |
commit | 2a76d4a960aa29621dc8020f84eee241b41e10c0 (patch) | |
tree | a832307a81752012ed19f946281c64fc7e72e2ed /advtrains/helpers.lua | |
parent | 254c32e304a4f279bf99e460727daf1b78050c47 (diff) | |
download | advtrains-2a76d4a960aa29621dc8020f84eee241b41e10c0.tar.gz advtrains-2a76d4a960aa29621dc8020f84eee241b41e10c0.tar.bz2 advtrains-2a76d4a960aa29621dc8020f84eee241b41e10c0.zip |
Fix final bugs and to-do's (u.a.save/load system)
Diffstat (limited to 'advtrains/helpers.lua')
-rw-r--r-- | advtrains/helpers.lua | 4 |
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
|