Documentation
    Preparing search index...

    Class AssetCameraRenderPlugin

    A plugin that manages interactions and operations related to the asset camera.

    Hierarchy

    • RendererPluginBase<Events>
      • AssetCameraRenderPlugin

    Implements

    • RendererPlugin
    Index

    Constructors

    Properties

    emitter: Emitter<Events> = ...

    An event emitter for handling custom events.

    Methods

    • Adds an event listener for a specific event.

      Type Parameters

      • K extends "cameraMoved"

        The type of the event key.

      Parameters

      • event: K

        The event to listen to.

      • listener: (eventData: Events[K]) => void

        The callback function to be invoked when the event is emitted.

      Returns { remove: () => void }

      An object with a remove method to unsubscribe the listener.

    • Registers an event listener handle to be managed by the plugin. Managed listeners will be automatically removed when the plugin is torn down.

      Parameters

      • handle: { remove: () => void } | (() => void)

        The event listener handle to manage.

      Returns void

    • Animates the camera to the home position. Home position is either computed based on the asset's bounds or set explicitly by setDefaultAssetHome.

      Parameters

      • duration: number

      Returns Promise<void>

    • Animates the camera to the specified look-at position.

      Parameters

      • lookAt: LookAt
      • onlyOrientation: boolean
      • duration: number = 1000

      Returns Promise<void>

    • Animates the camera to look at the center of the asset with a certain pitch, yaw and roll

      Parameters

      • lookAt: Partial<Exclude<LookAt, "ref" | "distance">> = {}
      • duration: number = 1000

      Returns Promise<void>

    • Tears down the plugin by removing all managed event listeners and clearing the event emitter. This method is called when the plugin is being destroyed.

      Parameters

      • _context: RendererPluginContext

        The plugin context provided during teardown.

      Returns void

    • Sets the default camera state (home position & orientation).

      If no default state is explicitly set, it will be computed based on the asset's bounds. The camera state that is passed should be in the reference of the asset.

      Parameters

      • OptionalcameraState: null | CameraState

        The new default camera state to set. If null is provided, the computed camera state will be used as the home position.

      Returns void