I found that this bug happens because in cart_func:is_rail(p) function minetest.env:get_node(p) sometimes returns "ignore" (as for unloaded area) I used simple hack d.y = 0 local p = cart_func.v3:add(cart_func.v3:copy(pos), d) if cart_func:is_rail(p) then return d end was changed to d.y = ...