aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2016-12-13 19:49:28 +0100
committerorwell96 <mono96.mml@gmail.com>2016-12-13 19:49:28 +0100
commit05ce694decc0653997f45fa4f9a24b40057dbd01 (patch)
tree1fe64198ba0e0bd5a26f9a01d359a9f9d8654d8b
parent6eea76a2ffad58628b0d8941e8d0ed34580a8876 (diff)
downloadadvtrains-05ce694decc0653997f45fa4f9a24b40057dbd01.tar.gz
advtrains-05ce694decc0653997f45fa4f9a24b40057dbd01.tar.bz2
advtrains-05ce694decc0653997f45fa4f9a24b40057dbd01.zip
Fix behavior when using get_look_yaw() instead of get_look_horizontal()
get_look_yaw returns values that are 90° rotated
-rw-r--r--advtrains.zipbin1488715 -> 1488724 bytes
-rw-r--r--tracks.lua2
2 files changed, 1 insertions, 1 deletions
diff --git a/advtrains.zip b/advtrains.zip
index 6640cfc..a3dab82 100644
--- a/advtrains.zip
+++ b/advtrains.zip
Binary files differ
diff --git a/tracks.lua b/tracks.lua
index bff88d3..99dbb27 100644
--- a/tracks.lua
+++ b/tracks.lua
@@ -473,7 +473,7 @@ function sl.create_slopeplacer_on_place(def, preset)
end
--determine player orientation (only horizontal component)
--get_look_horizontal may not be available
- local yaw=player.get_look_horizontal and player:get_look_horizontal() or player:get_look_yaw()
+ local yaw=player.get_look_horizontal and player:get_look_horizontal() or (player:get_look_yaw() - math.pi/2)
--rounding unit vectors is a nice way for selecting 1 of 8 directions since sin(30°) is 0.5.
dirvec={x=math.floor(math.sin(-yaw)+0.5), y=0, z=math.floor(math.cos(-yaw)+0.5)}