Gizmos are temporary objects that are drawn in the scene for debugging or visualization purposes
They are automatically removed after a given duration and cached internally to reduce overhead.
Use the static methods of this class to draw gizmos in the scene.

Properties

enabled: boolean = true

Allow creating gizmos
If disabled then no gizmos will be added to the scene anymore

Methods

  • Parameters

    • pt0: Vec3
    • pt1: Vec3
    • color: ColorRepresentation = defaultColor
    • duration: number = 0
    • depthTest: boolean = true
    • wireframe: boolean = false

    Returns void

  • Parameters

    • pt0: Vec3
    • normal: Vec3
    • radius: number
    • color: ColorRepresentation = defaultColor
    • duration: number = 0
    • depthTest: boolean = true

    Returns void

  • Parameters

    • pt: Vec3
    • direction: Vec3 | Vec4
    • color: ColorRepresentation = defaultColor
    • duration: number = 0
    • depthTest: boolean = true
    • lengthFactor: number = 1

    Returns void

  • Draw a label in the scene or attached to an object (if a parent is provided)

    Parameters

    Returns null | LabelHandle

    a handle to the label that can be used to change the text

  • Parameters

    • pt0: Vec3
    • pt1: Vec3
    • color: ColorRepresentation = defaultColor
    • duration: number = 0
    • depthTest: boolean = true

    Returns void

  • Parameters

    • origin: Vec3
    • dir: Vec3
    • color: ColorRepresentation = defaultColor
    • duration: number = 0
    • depthTest: boolean = true

    Returns void

  • Parameters

    • center: Vec3
    • radius: number
    • color: ColorRepresentation = defaultColor
    • duration: number = 0
    • depthTest: boolean = true

    Returns void

  • Parameters

    • center: Vec3
    • size: Vec3
    • color: ColorRepresentation = defaultColor
    • duration: number = 0
    • depthTest: boolean = true

    Returns void

  • Parameters

    • box: Box3
    • color: ColorRepresentation = defaultColor
    • duration: number = 0
    • depthTest: boolean = true

    Returns void

  • Render a wireframe mesh in the scene. The mesh will be removed after the given duration (if duration is 0 it will be rendered for one frame).
    If a mesh object is provided then the mesh's matrixWorld and geometry will be used. Otherwise, the provided matrix and geometry will be used.

    Parameters

    • options: {
          color?: ColorRepresentation | undefined;
          depthTest?: boolean;
          duration?: number;
      } & ({ mesh: Mesh } | { geometry: BufferGeometry; matrix: Matrix4 })

      the options for the wire mesh

      • Optionalcolor?: ColorRepresentation | undefined

        the color of the wire mesh

      • OptionaldepthTest?: boolean

        if true the wire mesh will be rendered with depth test

      • Optionalduration?: number

        the duration in seconds the mesh will be rendered. If 0 it will be rendered for one frame

      • { mesh: Mesh }
        • mesh: Mesh

          the mesh object to render (if it is provided the matrix and geometry will be used)

      • { geometry: BufferGeometry; matrix: Matrix4 }
        • geometry: BufferGeometry

          the geometry of the mesh to render

        • matrix: Matrix4

          the matrix of the mesh to render

    Returns void

    Gizmos.DrawWireMesh({ duration: 1, color: 0xff0000, mesh: myMesh });
    
  • Parameters

    • center: Vec3
    • radius: number
    • color: ColorRepresentation = defaultColor
    • duration: number = 0
    • depthTest: boolean = true

    Returns void

  • Returns true if a given object is a gizmo

    Parameters

    Returns boolean

  • Set visibility of all currently rendered gizmos

    Parameters

    • visible: boolean

    Returns void