Server-side rotations with smoothing, priorities and automatic freelook (camera stays put while server-side facing rotates).
| Function | What it does |
|---|---|
rotation.set(yaw, pitch[, priority]) |
Requests a rotation; returns true if accepted |
rotation.look_at(pos[, priority]) |
Faces a vec3 point (measured from the player’s eyes) |
rotation.camera() |
Rotates towards where the camera looks (priority 100) |
rotation.active() |
true while a managed rotation is running |
rotation.lock_item_use() |
Blocks new rotations until the end of the tick |
A request lasts one tick — to keep facing a direction, request every tick (usually
from pre_interaction or tick). A request with lower priority than the active one is
rejected.
module:event("pre_interaction", function()
local target = world:player("Notch")
if target then
rotation.look_at(target:position() + vec3(0, target:height() / 2, 0), 10)
end
end)