summaryrefslogtreecommitdiff
path: root/railcart/railcart.lua
diff options
context:
space:
mode:
authorstujones11 <stujones111@gmail.com>2016-01-22 18:54:56 +0000
committerstujones11 <stujones111@gmail.com>2016-01-22 18:54:56 +0000
commit0e9a29ddfc38ce8c198be21bd9597a7d5f03a9d4 (patch)
tree14072eb3afb5c17824530cd879c4fe0f78908d66 /railcart/railcart.lua
parentdc2ca22a8b876eac69947b244d4f6ae274927e59 (diff)
Set cart pitch and yaw on placement
Diffstat (limited to 'railcart/railcart.lua')
-rw-r--r--railcart/railcart.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/railcart/railcart.lua b/railcart/railcart.lua
index 68174b6..655fffe 100644
--- a/railcart/railcart.lua
+++ b/railcart/railcart.lua
@@ -215,11 +215,12 @@ function railcart:update(cart, time, object)
end
end
local speed = railcart:velocity_to_speed(cart.vel)
- if not cart.target then
+ if cart.target then
+ cart.dir = railtrack:get_direction(cart.target, cart.pos)
+ else
speed = 0
end
if speed > RAILCART_SPEED_MIN then
- cart.dir = railtrack:get_direction(cart.target, cart.pos)
local d1 = railtrack:get_distance(cart.prev, cart.target)
local d2 = railtrack:get_distance(cart.prev, cart.pos)
local dist = d1 - d2