PixiThree - v0.0.16
    Preparing search index...

    Function useThreeSceneContext

    • Hook to access the Three.js scene context. Provides coordinate mapping utilities between Pixi and Three.js coordinate spaces.

      Returns ThreeSceneContextValue

      ThreeSceneContextValue with bijection functions for coordinate mapping

      Context value for Three view coordinate mapping. Works in ThreeScene (inside CanvasView) and ThreeRenderTexture.

      • mapClientToNdc: (
            client: Point | { clientX: number; clientY: number },
            out?: Vector2,
        ) => Vector2 | null

        Maps DOM client coordinates to NDC coordinates.

      • mapNdcToPixi: (ndc: Vector2, out?: Point) => Point

        Maps Three.js NDC coordinates (-1 to 1) to a Pixi Point (in local sprite coordinates).

      • mapPixiToNdc: (point: Point, out?: Vector2) => Vector2

        Maps a Pixi Point (in local sprite coordinates) to Three.js NDC coordinates (-1 to 1).

      • mapThreeToClient: (vec3: Vector3, out?: Point) => Point[]

        Maps a Three.js world position to DOM client coordinates.

      • mapThreeToParentPixi: (vec3: Vector3, out?: Point) => Point

        Maps a Three.js world position to global Pixi parent coordinates.

      • mapThreeToParentPixiLocal: (vec3: Vector3, out?: Point) => Point

        Maps a Three.js world position to local Pixi sprite coordinates.

      • mapThreeToViewport: (vec3: Vector3, out?: Point) => Point[]

        Maps a Three.js world position to CanvasView viewport coordinates.

      • mapViewportToNdc: (viewport: Point, out?: Vector2) => Vector2 | null

        Maps viewport coordinates to NDC coordinates.

      • OptionalparentThree?: ThreeViewParentThreeContextValue

        Parent Three coordinate mapping functions. Only available inside a ThreeRenderTexture context.

      • raycastClient: <
            T extends
                Object3D<Object3DEventMap>
                | Plane
                | Object3D<Object3DEventMap>[] = Object3D<Object3DEventMap>,
        >(
            client: Point | { clientX: number; clientY: number },
            target?: T,
            recursive?: boolean,
        ) => RaycastResult<T>[]

        Raycasts from DOM client coordinates through the camera.

      • raycastNdc: <
            T extends
                Object3D<Object3DEventMap>
                | Plane
                | Object3D<Object3DEventMap>[] = Object3D<Object3DEventMap>,
        >(
            ndc: Vector2,
            target?: T,
            recursive?: boolean,
        ) => RaycastResult<T>[]

        Raycasts from NDC coordinates through the camera.

      • raycastViewport: <
            T extends
                Object3D<Object3DEventMap>
                | Plane
                | Object3D<Object3DEventMap>[] = Object3D<Object3DEventMap>,
        >(
            viewport: Point,
            target?: T,
            recursive?: boolean,
        ) => RaycastResult<T>[]

        Raycasts from viewport coordinates through the camera.

      Error if called outside of a ThreeScene component