Files

845 B
Raw Permalink Blame History

DeicideLookS.js — main() (satır 14)

← DeicideLookS.js · ← Master

function main(c)
{
    var target = c.getSubject();
    var source = c.getServer().getPlayer("Xyrveth");

    var sourcePos = source.getPosition();
    var targetPos = target.getPosition();

    var sourceEyes = {
        x: sourcePos.x,
        y: sourcePos.y + source.getEyeHeight(),
        z: sourcePos.z
    };

    var targetEyes = {
        x: targetPos.x,
        y: targetPos.y + target.getEyeHeight(),
        z: targetPos.z
    };

    var look = calculateLookRotation(targetEyes, sourceEyes);

    target.setRotations(look.pitch, look.yaw, look.yaw);
    target.lockRotation(look.yaw, look.pitch, look.yaw);
    target.lockPosition(targetPos.x, targetPos.y, targetPos.z);
}