Files

447 B
Raw Permalink Blame History

Hipnoz.js — calculateLookRotation() (satır 1)

← Hipnoz.js · ← Master

function calculateLookRotation(from, to)
{
    var dx = to.x - from.x;
    var dy = to.y - from.y;
    var dz = to.z - from.z;
    var flat = Math.sqrt(dx * dx + dz * dz);

    return {
        yaw: Math.atan2(-dx, dz) * 180 / Math.PI,
        pitch: -Math.atan2(dy, flat) * 180 / Math.PI
    };
}