Class BoundingBoxGizmo
Hierarchy (View Summary)
- Gizmo
- BoundingBoxGizmo
Implements
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Creates an BoundingBoxGizmo
Parameters
- color: Color3 = ...
The color of the gizmo
- gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultKeepDepthUtilityLayer
The utility layer the gizmo will be added to
Returns BoundingBoxGizmo
- color: Color3 = ...
Properties
_ root Mesh
The root mesh of the gizmo
fixed Drag Mesh Bounds Size
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
fixed Drag Mesh Screen Size
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
fixed Drag Mesh Screen Size Distance Factor
The distance away from the object which the draggable meshes should appear world sized when fixedDragMeshScreenSize is set to true (default: 10)
gizmo Layer
[Object] The utility layer the gizmo will be added to
ignore Children
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)
include Child Predicate
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)
incremental Snap
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,...
on Drag Start Observable
Fired when a rotation anchor or scale box is dragged
on Hover End Observable
Fired when the gizmo mesh hovering ends
on Hover Start Observable
Fired when the gizmo mesh hovering starts
on Rotation Sphere Drag End Observable
{ dragAxis: Vector3; dragOperation: DragOperation },
> = ...
Fired when a rotation anchor drag is ended
on Rotation Sphere Drag Observable
{ dragAxis: Vector3; dragOperation: DragOperation },
> = ...
Fired when a rotation anchor is dragged
on Scale Box Drag End Observable
{ dragAxis: Vector3; dragOperation: DragOperation },
> = ...
Fired when a scale box drag is ended
on Scale Box Drag Observable
Fired when a scale box is dragged
rotation Snap Distance
Drag distance in babylon units that the gizmo will snap rotation to when dragged
rotation Sphere Size
The size of the rotation anchors attached to the bounding box (Default: 0.1)
scale Box Size
The size of the scale boxes attached to the bounding box (Default: 0.1)
scale Pivot
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)
scaling Snap Distance
Drag distance in babylon units that the gizmo will snap scaling to when dragged
StaticPreserve Scaling
When enabled, any gizmo operation will preserve scaling sign. Default is off. Only valid for TransformNode derived classes (Mesh, AbstractMesh, ...)
StaticUse Absolute Scaling
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)
Accessors
additional Transform Node
-
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
-
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
- value: TransformNode | undefined
Returns void
anchor Point
-
Defines where the gizmo will be positioned if
updateGizmoPositionToMatchAttachedMeshis enabled. (Default: GizmoAnchorPoint.Origin)Returns GizmoAnchorPoint
-
Defines where the gizmo will be positioned if
updateGizmoPositionToMatchAttachedMeshis enabled. (Default: GizmoAnchorPoint.Origin)Parameters
- value: GizmoAnchorPoint
Returns void
attached Mesh
-
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
Returns 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
Parameters
- value: Nullable<AbstractMesh>
Returns void
attached Node
axis Factor
colored Material
-
Default material used to render when gizmo is not disabled or hovered
Returns StandardMaterial
coordinates Mode
-
Set the coordinate mode to use. By default it's local.
Returns GizmoCoordinatesMode
-
Set the coordinate system to use. By default it's local. But it's possible for a user to tweak so its local for translation and world for rotation. In that case, setting the coordinate system will change
updateGizmoRotationToMatchAttachedMeshandupdateGizmoPositionToMatchAttachedMeshParameters
- coordinatesMode: GizmoCoordinatesMode
Returns void
custom Rotation Quaternion
-
Orientation that the gizmo will be displayed with. When set null, default value will be used (Quaternion(0, 0, 0, 1))
Returns Nullable<Quaternion>
-
Orientation that the gizmo will be displayed with. When set null, default value will be used (Quaternion(0, 0, 0, 1))
Parameters
- customRotationQuaternion: Nullable<Quaternion>
Returns void
hover Material
-
Material used to render when gizmo is hovered with mouse
Returns StandardMaterial
is Dragging
-
get isDragging(): boolean
True when a rotation anchor or scale box or a attached mesh is dragged
Returns boolean
is Hovered
-
get isHovered(): boolean
True when the mouse pointer is hovered a gizmo mesh
Returns boolean
pointer Drag Behavior
-
Get the pointerDragBehavior
Returns PointerDragBehavior
scale Drag Speed
-
get scaleDragSpeed(): number
Gets scale drag speed
Returns number
the scale speed number
-
set scaleDragSpeed(value: number): void
Sets scale drag speed value
Parameters
- value: number
the new speed value
Returns void
- value: number
scale Ratio
-
get scaleRatio(): number
Ratio for the scale of the gizmo
Returns number
-
set scaleRatio(value: number): void
Ratio for the scale of the gizmo (Default: 1)
Parameters
- value: number
Returns void
update Gizmo Position To Match Attached Mesh
-
get updateGizmoPositionToMatchAttachedMesh(): boolean
If set the gizmo's position will be updated to match the attached mesh each frame (Default: true)
Returns boolean
-
set updateGizmoPositionToMatchAttachedMesh(value: boolean): void
If set the gizmo's position will be updated to match the attached mesh each frame (Default: true)
Parameters
- value: boolean
Returns void
update Gizmo Rotation To Match Attached Mesh
-
get updateGizmoRotationToMatchAttachedMesh(): boolean
If set the gizmo's rotation will be updated to match the attached mesh each frame (Default: true)
Returns boolean
-
set updateGizmoRotationToMatchAttachedMesh(value: boolean): void
If set the gizmo's rotation will be updated to match the attached mesh each frame (Default: true) NOTE: This is only possible for meshes with uniform scaling, as otherwise it's not possible to decompose the rotation
Parameters
- value: boolean
Returns void
update Scale
-
get updateScale(): boolean
When set, the gizmo will always appear the same size no matter where the camera is (default: true)
Returns boolean
-
set updateScale(value: boolean): void
When set, the gizmo will always appear the same size no matter where the camera is (default: true)
Parameters
- value: boolean
Returns void
Methods
dispose
-
Disposes of the gizmo
Returns void
enable Drag Behavior
-
Enables a pointer drag behavior on the bounding box of the gizmo
Returns void
get Scale Boxes
-
returns an array containing all boxes used for scaling (in increasing x, y and z orders)
Returns AbstractMesh[]
array of scaling boxes
release Drag
-
Force release the drag action by code
Returns void
set Color
set Custom Mesh
-
CustomMeshes are not supported by this gizmo
Returns void
set Enabled Rotation Axis
-
Enables rotation on the specified axis and disables rotation on the others
Parameters
- axis: string
The list of axis that should be enabled (eg. "xy" or "xyz")
Returns void
- axis: string
set Enabled Scaling
-
Enables/disables scaling
Parameters
- enable: boolean
if scaling should be enabled
- homogeneousScaling: boolean = false
defines if scaling should only be homogeneous
Returns void
- enable: boolean
update Bounding Box
-
Updates the bounding box information for the Gizmo
Returns void
StaticGizmo Axis Pointer Observer
-
GizmoAxisPointerObserver(
gizmoLayer: UtilityLayerRenderer,
gizmoAxisCache: Map<Mesh, GizmoAxisCache>,
): Observer<PointerInfo>Subscribes to pointer up, down, and hover events. Used for responsive gizmos.
Parameters
- gizmoLayer: UtilityLayerRenderer
The utility layer the gizmo will be added to
- gizmoAxisCache: Map<Mesh, GizmoAxisCache>
Gizmo axis definition used for reactive gizmo UI
Returns Observer<PointerInfo>
pointerObserver
- gizmoLayer: UtilityLayerRenderer
StaticMake Not Pickable And Wrap In Bounding Box
-
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
- mesh: Mesh
Bounding box gizmo