API

Class BoundingBoxGizmo

Bounding box gizmo

Hierarchy (View Summary)

Implements

Index
_rootMesh: Mesh

The root mesh of the gizmo

fixedDragMeshBoundsSize: boolean = false

If set, the rotation anchors and scale boxes will increase in size based on the size of the bounding box Note : fixedDragMeshScreenSize takes precedence over fixedDragMeshBoundsSize if both are true

fixedDragMeshScreenSize: boolean = false

If set, the rotation anchors and scale boxes will increase in size based on the distance away from the camera to have a consistent screen size (Default: false) Note : fixedDragMeshScreenSize takes precedence over fixedDragMeshBoundsSize if both are true

fixedDragMeshScreenSizeDistanceFactor: number = 10

The distance away from the object which the draggable meshes should appear world sized when fixedDragMeshScreenSize is set to true (default: 10)

gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer

[Object] The utility layer the gizmo will be added to

ignoreChildren: boolean = false

If child meshes should be ignored when calculating the bounding box. This should be set to true to avoid perf hits with heavily nested meshes (Default: false)

includeChildPredicate: Nullable<(abstractMesh: AbstractMesh) => boolean> = null

Returns true if a descendant should be included when computing the bounding box. When null, all descendants are included. If ignoreChildren is set this will be ignored. (Default: null)

incrementalSnap: boolean = false

Incremental snap scaling (default is false). When true, with a snapDistance of 0.1, scaling will be 1.1,1.2,1.3 instead of, when false: 1.1,1.21,1.33,...

onDragStartObservable: Observable<
    { dragAxis: Vector3; dragOperation: DragOperation },
> = ...

Fired when a rotation anchor or scale box is dragged

onHoverEndObservable: Observable<void> = ...

Fired when the gizmo mesh hovering ends

onHoverStartObservable: Observable<void> = ...

Fired when the gizmo mesh hovering starts

onRotationSphereDragEndObservable: Observable<
    { dragAxis: Vector3; dragOperation: DragOperation },
> = ...

Fired when a rotation anchor drag is ended

onRotationSphereDragObservable: Observable<
    { dragAxis: Vector3; dragOperation: DragOperation },
> = ...

Fired when a rotation anchor is dragged

onScaleBoxDragEndObservable: Observable<
    { dragAxis: Vector3; dragOperation: DragOperation },
> = ...

Fired when a scale box drag is ended

onScaleBoxDragObservable: Observable<
    { dragAxis: Vector3; dragOperation: DragOperation },
> = ...

Fired when a scale box is dragged

rotationSnapDistance: number = 0

Drag distance in babylon units that the gizmo will snap rotation to when dragged

rotationSphereSize: number = 0.1

The size of the rotation anchors attached to the bounding box (Default: 0.1)

scaleBoxSize: number = 0.1

The size of the scale boxes attached to the bounding box (Default: 0.1)

scalePivot: Nullable<Vector3> = null

Relative bounding box pivot used when scaling the attached node. When null object with scale from the opposite corner. 0.5,0.5,0.5 for center and 0.5,0,0.5 for bottom (Default: null)

scalingSnapDistance: number = 0

Drag distance in babylon units that the gizmo will snap scaling to when dragged

PreserveScaling: boolean = false

When enabled, any gizmo operation will preserve scaling sign. Default is off. Only valid for TransformNode derived classes (Mesh, AbstractMesh, ...)

UseAbsoluteScaling: boolean = true

There are 2 ways to preserve scaling: using mesh scaling or absolute scaling. Depending of hierarchy, non uniform scaling and LH or RH coordinates. One is preferable than the other. If the scaling to be preserved is the local scaling, then set this value to false. Default is true which means scaling to be preserved is absolute one (with hierarchy applied)

  • get additionalTransformNode(): TransformNode | undefined

    Additional transform applied to the gizmo. It's useful when the gizmo is attached to a bone: if the bone is part of a skeleton attached to a mesh, you should define the mesh as additionalTransformNode if you want the gizmo to be displayed at the bone's correct location. Otherwise, as the gizmo is relative to the skeleton root, the mesh transformation will not be taken into account.

    Returns TransformNode | undefined

  • set additionalTransformNode(value: TransformNode | undefined): void

    Additional transform applied to the gizmo. It's useful when the gizmo is attached to a bone: if the bone is part of a skeleton attached to a mesh, you should define the mesh as additionalTransformNode if you want the gizmo to be displayed at the bone's correct location. Otherwise, as the gizmo is relative to the skeleton root, the mesh transformation will not be taken into account.

    Parameters

    Returns void

  • Makes a mesh not pickable and wraps the mesh inside of a bounding box mesh that is pickable. (This is useful to avoid picking within complex geometry)

    Parameters

    • mesh: Mesh

      the mesh to wrap in the bounding box mesh and make not pickable

    Returns Mesh

    the bounding box mesh with the passed in mesh as a child