Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local clutch = false
- local gear = false
- local yaw, pitch = 0
- local tYaw, tPitch = 0
- local angTolerance = 0.5
- function GetAng()
- local x,y,z = ship.getQuaternion():toEuler()
- yaw = y
- end
- function Left()
- clutch = false
- gear = false
- end
- function Right()
- clutch = false
- gear = true
- end
- function Stop()
- clutch = true
- gear = false
- end
- local yawDiff = 0
- function RotateToAng()
- yawDiff = tYaw - yaw
- if math.abs(yawDiff) < angTolerance then
- Stop()
- return
- end
- if yawDiff > 0 then
- Right()
- else
- Left()
- end
- end
- while true do
- GetAng()
- RotateToAng()
- print(yawDiff)
- redstone.setOutput("left", gear)
- redstone.setOutput("right",clutch)
- sleep(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment