P3d.in Embed API
    Preparing search index...

    Class P3dHotspot

    Hierarchy

    • P3dValueCached
      • P3dHotspot
    Index

    Accessors

    • get children(): P3dHotspot[]

      Get array of all hotspots that this hotspot is parent of

      Returns P3dHotspot[]

    • get description(): string

      Hotspot description as defined in p3d.in, or empty string if not set

      Returns string

    • set description(value: string): void

      Parameters

      • value: string

      Returns void

    • get id(): string

      Unique string identifier for the object

      Returns string

    • get index(): number

      Returns number

    • get isVisible(): boolean

      Determine if this hotspot is rendered

      Returns boolean

    • set isVisible(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get parentHotspot(): null | P3dHotspot

      Another hotspot that this hotspot is child of, if any.

      Returns null | P3dHotspot

    • set parentHotspot(parent: null | P3dHotspot): void

      Parameters

      Returns void

    • get title(): string

      Hotspot title as defined in p3d.in. Eg. "Hotspot 1"

      Returns string

    • set title(value: string): void

      Parameters

      • value: string

      Returns void

    Methods

    • Get hotspot position in screen space x and y coordinates

      hotspot.getScreenCoordinates().then((resp) => {
      console.log('Hotspot is at', resp.x, resp.y, 'pixels');
      });

      Returns Promise<{ x: number; y: number; z: number }>

    • Select this hotpot.

      Returns void

    • Set transform that camera will move to when hotspot is selected. Coordinates are in scene space.

      Only the given coordinates are updated. So if you only want to change the point camera is directed at, you can only provide "target", but not "location". Then camera location itself will not be changed when hotspot is selected.

      For example target scene origin and move camera 2 meters on z axis.

      hotspot.setCameraTransform({
      target: {x: 0, y: 0, z: 0},
      location: {x: 0, y: 0, z: 0},
      });

      Parameters

      Returns void

    • Place hotspot in given x, y and z coordinates relative to parent object if any.

      Optionally you can also provide a parent object. Given coordinates are relative to the parent, so 0, 0, 0 coordinates will be at the center of the parent object.

      For example place hotspot at location of another object:

      hotspot.setLocation(0, 0, 0, object);
      

      Parameters

      • x: number
      • y: number
      • z: number
      • Optionalparent: P3dObject

      Returns void

    • Place hotspot in given x, y and z scene coordinates.

      Optionally you can also provide a parent object. In that case coordinates are adjusted so that final scene coordinates match given values even with the parent hierarchy in place.

      For example place hotspot at click coordinates on Embed API onclick callback:

      onclick: (e) => {
      hotspot.setSceneLocation(e.coordinates.x, e.coordinates.y, e.coordinates.z, e.object);
      }

      Parameters

      • x: number
      • y: number
      • z: number
      • Optionalparent: P3dObject

      Returns void