Set the yaw to the moving direction
parent
d85c46f778
commit
06ba2bfff4
10
init.lua
10
init.lua
|
@ -340,6 +340,16 @@ function cart:on_step(dtime)
|
|||
self.old_pos = self.object:getpos()
|
||||
self.old_velocity = cart_func.v3:copy(self.velocity)
|
||||
|
||||
if dir.x < 0 then
|
||||
self.object:setyaw(math.pi/2)
|
||||
elseif dir.x > 0 then
|
||||
self.object:setyaw(3*math.pi/2)
|
||||
elseif dir.z < 0 then
|
||||
self.object:setyaw(math.pi)
|
||||
elseif dir.z > 0 then
|
||||
self.object:setyaw(0)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
minetest.register_entity("carts:cart", cart)
|
||||
|
|
Loading…
Reference in New Issue