lookAtFrom method

void lookAtFrom(
  1. Vector3 eye,
  2. Vector3 target, {
  3. Vector3? up,
})

Places the node at eye and orients its forward axis (local +Z) at target in world space. The imperative camera one-liner, positioning and aiming in a single call; the node's world scale is preserved. See lookAt for the forward-axis convention and the up constraint.

Implementation

void lookAtFrom(Vector3 eye, Vector3 target, {Vector3? up}) {
  final world = globalTransform.storage;
  final scale = Vector3(
    Vector3(world[0], world[1], world[2]).length,
    Vector3(world[4], world[5], world[6]).length,
    Vector3(world[8], world[9], world[10]).length,
  );
  globalTransform = _lookAtMatrix(
    eye,
    target,
    up ?? Vector3(0.0, 1.0, 0.0),
    scale,
  );
}