calculateRotationAxis method

Vector3 calculateRotationAxis(
  1. Vector3 vec1,
  2. Vector3 vec2
)
  • Calculate the rotation axis as the vector perpendicular between two vectors
  • vec1 The first vector
  • vec2 The second vector
  • returns Vector3 The normalized rotation axis

Implementation

Vector3 calculateRotationAxis(Vector3 vec1, Vector3 vec2) {
    _rotationMatrix.extractRotation(_cameraMatrixState);
    _quat.setFromRotationMatrix(_rotationMatrix);

    _rotationAxis.cross2(vec1, vec2).applyQuaternion(_quat);
    return _rotationAxis.normalize().clone();
  }