Options
All
  • Public
  • Public/Protected
  • All
Menu

Class P3dHotspot

Hierarchy

  • P3dValueCached
    • P3dHotspot

Index

Accessors

description

  • get description(): string
  • set description(value: string): void
  • Hotspot description as defined in p3d.in, or empty string if not set

    Returns string

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

    Parameters

    • value: string

    Returns void

id

  • get id(): string
  • Unique string identifier for the object

    Returns string

index

  • get index(): number
  • Returns number

isVisible

  • get isVisible(): boolean
  • set isVisible(value: boolean): void
  • Determine if this hotspot is rendered

    Returns boolean

  • Determine if this hotspot is rendered

    Parameters

    • value: boolean

    Returns void

title

  • get title(): string
  • set title(value: string): void
  • Hotspot title as defined in p3d.in. Eg. "Hotspot 1"

    Returns string

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

    Parameters

    • value: string

    Returns void

Methods

getScreenCoordinates

  • getScreenCoordinates(): Promise<{ x: number; y: number }>
  • 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 }>

select

  • select(): void
  • Select this hotpot.

    Returns void

setCameraTransform

  • 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

setLocation

  • setLocation(x: number, y: number, z: number, parent?: P3dObject): 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
    • Optional parent: P3dObject

    Returns void

setSceneLocation

  • setSceneLocation(x: number, y: number, z: number, parent?: P3dObject): 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
    • Optional parent: P3dObject

    Returns void

Generated using TypeDoc