projectOnVector method

Vector3 projectOnVector(
  1. Vector3 v
)

Implementation

Vector3 projectOnVector(Vector3 v) {
  var denominator = v.lengthSq();

  if (denominator == 0) return set(0, 0, 0);

  var scalar = v.dot(this) / denominator;

  return copy(v).multiplyScalar(scalar);
}