Calculate the angle in radians of the direction from the from vector to the to vector, measured from the positive x axis in the atan2 range of -π to π.
from
to
Vector to calculate to.
Vector to calculate from. Defaults to ZERO.
ZERO
angleTo({ x: 0, y: 1 }); // -> 1.5707963267948966 (Math.PI / 2)angleTo({ x: 2, y: 2 }, { x: 1, y: 1 }); // -> 0.7853981633974483 (Math.PI / 4) Copy
angleTo({ x: 0, y: 1 }); // -> 1.5707963267948966 (Math.PI / 2)angleTo({ x: 2, y: 2 }, { x: 1, y: 1 }); // -> 0.7853981633974483 (Math.PI / 4)
Calculate the angle in radians of the direction from the
fromvector to thetovector, measured from the positive x axis in the atan2 range of -π to π.