Files

761 B
Raw Permalink Blame History

KlonlanmaLal.js — offsetFor() (satır 457)

← KlonlanmaLal.js · ← Master

function offsetFor(owner, index, count, radius, tick, ownerMoving) {
    var slot = ownerMoving ? followSlot(index) : formationSlot(index, count);
    var jitter = ownerMoving ? Math.sin((tick + index * 23) * 0.07) * 0.12 : 0;
    var yawRad = owner.getYaw() * Math.PI / 180;
    var localX = (slot.x + jitter) * radius;
    var localZ = slot.z * radius;
    var rightX = Math.cos(yawRad);
    var rightZ = Math.sin(yawRad);
    var backX = Math.sin(yawRad);
    var backZ = -Math.cos(yawRad);

    return {
        x: localX * rightX + localZ * backX,
        z: localX * rightZ + localZ * backZ
    };
}