Incomprehensible

angtest1

Mar 17th, 2026 (edited)
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | None | 0 0
  1. local clutch = false
  2. local gear = false
  3.  
  4. local yaw, pitch = 0
  5. local tYaw, tPitch = 0
  6. local angTolerance = 0.5
  7.  
  8. function GetAng()
  9.     local x,y,z = ship.getQuaternion():toEuler()
  10.     yaw = y
  11. end
  12.  
  13. function Left()
  14.     clutch = false
  15.     gear = false
  16. end
  17.  
  18. function Right()
  19.     clutch = false
  20.     gear = true
  21. end
  22.  
  23. function Stop()
  24.     clutch = true
  25.     gear = false
  26. end
  27.  
  28. local yawDiff = 0
  29.  
  30. function RotateToAng()
  31.     yawDiff = tYaw - yaw
  32.     if math.abs(yawDiff) < angTolerance then
  33.         Stop()
  34.         return
  35.     end
  36.  
  37.     if yawDiff > 0 then
  38.         Right()
  39.     else
  40.         Left()
  41.     end
  42. end
  43.  
  44. while true do
  45.  
  46.     GetAng()
  47.     RotateToAng()
  48.     print(yawDiff)
  49.     redstone.setOutput("left", gear)
  50.     redstone.setOutput("right",clutch)
  51.     sleep(0.1)
  52. end
Advertisement
Add Comment
Please, Sign In to add comment