From 0e9a29ddfc38ce8c198be21bd9597a7d5f03a9d4 Mon Sep 17 00:00:00 2001 From: stujones11 Date: Fri, 22 Jan 2016 18:54:56 +0000 Subject: Set cart pitch and yaw on placement --- railcart/railcart.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'railcart/railcart.lua') 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 -- cgit v1.2.3