• Look at a 2D point in screen space

    Parameters

    • object: Object3D

      the object to look at the point

    • target: Vector2Like

      the target point in 2D screen space XY e.g. from a mouse event

    • camera: Camera

      the camera to use for the lookAt

    • factor: number = 1

      the factor to multiply the distance from the camera to the object. Default is 1

    Returns null | Vector3

    the target point in world space

    export class MyLookAtComponent extends Behaviour {      
    update() {
    lookAtScreenPoint(this.gameObject, this.context.input.mousePosition, this.context.mainCamera);
    }
    }
    window.addEventListener("mousemove", (e) => {
    lookAtScreenPoint(object, new Vector2(e.clientX, e.clientY), camera);
    });
MMNEPVFCICPMFPCPTTAAATR