Advertisement
osmarks

creepystare

Feb 15th, 2019
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local mods = peripheral.wrap "back"
  2.  
  3. local function yaw_and_pitch(e)
  4.     local x, y, z = e.x, e.y, e.z
  5.     local pitch = -math.atan2(y, math.sqrt(x * x + z * z))
  6.     local yaw = math.atan2(-x, z)
  7.     return math.deg(yaw), math.deg(pitch)
  8. end
  9.  
  10. while true do
  11.     for _, e in pairs(mods.sense()) do
  12.         if e.pitch ~= 0 and e.displayName == e.name then -- good heuristic for player detection
  13.             local y, p = yaw_and_pitch(e)
  14.             mods.look(y, p)
  15.         end
  16.     end
  17.     sleep(0.1)
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement