aboutsummaryrefslogtreecommitdiff
path: root/wagons.lua
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2016-09-29 08:31:57 +0200
committerorwell96 <mono96.mml@gmail.com>2016-09-29 08:31:57 +0200
commit76bd8eaabaf7a81d723e0db5d55004eadb343e92 (patch)
treeba589974850f84cee49ed4dae2e892402b7f61ad /wagons.lua
parentbb50b390d4b0669718eb9872d294256e026b42ca (diff)
downloadadvtrains-76bd8eaabaf7a81d723e0db5d55004eadb343e92.tar.gz
advtrains-76bd8eaabaf7a81d723e0db5d55004eadb343e92.tar.bz2
advtrains-76bd8eaabaf7a81d723e0db5d55004eadb343e92.zip
fix train entities moving with wrong speed
Diffstat (limited to 'wagons.lua')
-rw-r--r--wagons.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/wagons.lua b/wagons.lua
index c0a2f77..304061b 100644
--- a/wagons.lua
+++ b/wagons.lua
@@ -300,7 +300,8 @@ function wagon:on_step(dtime)
end
end
- local velocity=gp.velocity/(gp.path_dist[math.floor(gp.index)] or 1)
+ --FIX: use index of the wagon, not of the train.
+ local velocity=gp.velocity/(gp.path_dist[math.floor(index)] or 1)
local factor=index-math.floor(index)
local actual_pos={x=first_pos.x-(first_pos.x-second_pos.x)*factor, y=first_pos.y-(first_pos.y-second_pos.y)*factor, z=first_pos.z-(first_pos.z-second_pos.z)*factor,}
local velocityvec={x=(first_pos.x-second_pos.x)*velocity*-1, z=(first_pos.z-second_pos.z)*velocity*-1, y=(first_pos.y-second_pos.y)*velocity*-1}