lookAt method

void lookAt(
  1. Vector3 position
)

Implementation

void lookAt(Vector3 position) {
  // This method does not support objects having non-uniformly-scaled parent(s)

  _target.copy(position);

  var parent = this.parent;

  updateWorldMatrix(true, false);

  _position.setFromMatrixPosition(matrixWorld);

  // TODO
  if (this is Camera || this is Light) {
    _m1.lookAt(_position, _target, up);
  } else {
    _m1.lookAt(_target, _position, up);
  }

  quaternion.setFromRotationMatrix(_m1);

  if (parent != null) {
    _m1.extractRotation(parent.matrixWorld);
    _q1.setFromRotationMatrix(_m1);
    quaternion.premultiply(_q1.invert());
  }
}