API

Interface IScaleGizmo

Interface for scale gizmo

interface IScaleGizmo {
    _rootMesh: Mesh;
    additionalTransformNode?: TransformNode;
    anchorPoint: GizmoAnchorPoint;
    attachedMesh: Nullable<AbstractMesh>;
    attachedNode: Nullable<Node>;
    coloredMaterial: StandardMaterial;
    coordinatesMode: GizmoCoordinatesMode;
    customRotationQuaternion: Nullable<Quaternion>;
    disableMaterial: StandardMaterial;
    gizmoLayer: UtilityLayerRenderer;
    hoverMaterial: StandardMaterial;
    incrementalSnap: boolean;
    isDragging: boolean;
    isHovered: boolean;
    onDragEndObservable: Observable<DragStartEndEvent>;
    onDragObservable: Observable<DragEvent>;
    onDragStartObservable: Observable<DragStartEndEvent>;
    scaleRatio: number;
    sensitivity: number;
    snapDistance: number;
    uniformScaleGizmo: IAxisScaleGizmo;
    updateGizmoPositionToMatchAttachedMesh: boolean;
    updateGizmoRotationToMatchAttachedMesh: boolean;
    updateScale: boolean;
    xGizmo: IAxisScaleGizmo;
    yGizmo: IAxisScaleGizmo;
    zGizmo: IAxisScaleGizmo;
    addToAxisCache(mesh: Mesh, cache: GizmoAxisCache): void;
    dispose(): void;
    releaseDrag(): void;
    setCustomMesh(mesh: Mesh): void;
}

Hierarchy (View Summary)

Implemented by

Index
_rootMesh: Mesh

The root mesh of the gizmo

additionalTransformNode?: TransformNode

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.

anchorPoint: GizmoAnchorPoint

Defines where the gizmo will be positioned if updateGizmoPositionToMatchAttachedMesh is enabled. (Default: GizmoAnchorPoint.Origin)

attachedMesh: Nullable<AbstractMesh>

Mesh that the gizmo will be attached to. (eg. on a drag gizmo the mesh that will be dragged)

  • When set, interactions will be enabled
attachedNode: Nullable<Node>

Node that the gizmo will be attached to. (eg. on a drag gizmo the mesh, bone or NodeTransform that will be dragged)

  • When set, interactions will be enabled
coloredMaterial: StandardMaterial

Default material used to render when gizmo is not disabled or hovered

coordinatesMode: GizmoCoordinatesMode

Set the coordinate mode to use. By default it's local.

customRotationQuaternion: Nullable<Quaternion>

Orientation that the gizmo will be displayed with. When set null, default value will be used (Quaternion(0, 0, 0, 1))

disableMaterial: StandardMaterial

Material used to render when gizmo is disabled. typically grey.

The utility layer the gizmo will be added to

hoverMaterial: StandardMaterial

Material used to render when gizmo is hovered with mouse

incrementalSnap: boolean

Incremental snap scaling. 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,...

isDragging: boolean

True when the mouse pointer is dragging a gizmo mesh

isHovered: boolean

True when the mouse pointer is hovered a gizmo mesh

onDragEndObservable: Observable<DragStartEndEvent>

Fires an event when any of it's sub gizmos are released from dragging

onDragObservable: Observable<DragEvent>

Fires an event when any of it's sub gizmos are being dragged

onDragStartObservable: Observable<DragStartEndEvent>

Fires an event when any of it's sub gizmos are dragged

scaleRatio: number

Ratio for the scale of the gizmo

sensitivity: number

Sensitivity factor for dragging

snapDistance: number

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

uniformScaleGizmo: IAxisScaleGizmo

Internal gizmo used to scale all axis equally

updateGizmoPositionToMatchAttachedMesh: boolean

If set the gizmo's position will be updated to match the attached mesh each frame (Default: true)

updateGizmoRotationToMatchAttachedMesh: boolean

If set the gizmo's rotation will be updated to match the attached mesh each frame (Default: true)

updateScale: boolean

When set, the gizmo will always appear the same size no matter where the camera is (default: true)

Internal gizmo used for interactions on the x axis

Internal gizmo used for interactions on the y axis

Internal gizmo used for interactions on the z axis