Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local mods = peripheral.wrap "back"
- local function yaw_and_pitch(e)
- local x, y, z = e.x, e.y, e.z
- local pitch = -math.atan2(y, math.sqrt(x * x + z * z))
- local yaw = math.atan2(-x, z)
- return math.deg(yaw), math.deg(pitch)
- end
- while true do
- for _, e in pairs(mods.sense()) do
- if e.pitch ~= 0 and e.displayName == e.name then -- good heuristic for player detection
- local y, p = yaw_and_pitch(e)
- mods.look(y, p)
- end
- end
- sleep(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement