Class ScaleGizmo
Hierarchy (View Summary)
- Gizmo
- ScaleGizmo
Implements
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
new ScaleGizmo(
gizmoLayer?: UtilityLayerRenderer,
thickness?: number,
gizmoManager?: GizmoManager,
options?: ScaleGizmoOptions,
): ScaleGizmoCreates a ScaleGizmo
Parameters
- gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer
The utility layer the gizmo will be added to
- thickness: number = 1
display gizmo axis thickness
OptionalgizmoManager: GizmoManagerOptionaloptions: ScaleGizmoOptionsMore options
Returns ScaleGizmo
- gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer
Properties
_ root Mesh
The root mesh of the gizmo
gizmo Layer
[Object] The utility layer the gizmo will be added to
on Drag End Observable
Fires an event when any of it's sub gizmos are released from dragging
on Drag Observable
Fires an event when any of it's sub gizmos are being dragged
on Drag Start Observable
Fires an event when any of it's sub gizmos are dragged
uniform Scale Gizmo
Internal gizmo used to scale all axis equally
x Gizmo
Internal gizmo used for interactions on the x axis
y Gizmo
Internal gizmo used for interactions on the y axis
z Gizmo
Internal gizmo used for interactions on the z axis
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
- transformNode: 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
- mesh: Nullable<AbstractMesh>
Returns void
attached Node
colored Material
-
Default material used to render when gizmo is not disabled or hovered
Returns StandardMaterial
coordinates Mode
-
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
disable Material
-
Material used to render when gizmo is disabled. typically grey.
Returns StandardMaterial
hover Material
-
Material used to render when gizmo is hovered with mouse
Returns StandardMaterial
incremental Snap
-
get 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,...
Returns boolean
-
set incrementalSnap(value: boolean): void
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,...
Parameters
- value: boolean
Returns void
is Dragging
-
get isDragging(): boolean
True when the mouse pointer is dragging a gizmo mesh
Returns boolean
is Hovered
-
get isHovered(): boolean
True when the mouse pointer is hovering a gizmo mesh
Returns boolean
scale Ratio
-
get scaleRatio(): number
Ratio for the scale of the gizmo (Default: 1)
Returns number
-
set scaleRatio(value: number): void
Ratio for the scale of the gizmo (Default: 1)
Parameters
- value: number
Returns void
sensitivity
-
get sensitivity(): number
Sensitivity factor for dragging
Returns number
-
set sensitivity(value: number): void
Sensitivity factor for dragging (Default: 1)
Parameters
- value: number
Returns void
snap Distance
-
get snapDistance(): number
Drag distance in babylon units that the gizmo will snap to when dragged
Returns number
-
set snapDistance(value: number): void
Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)
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) NOTE: This is only possible for meshes with uniform scaling, as otherwise it's not possible to decompose the rotation
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
add To Axis Cache
-
Builds Gizmo Axis Cache to enable features such as hover state preservation and graying out other axis during manipulation
Parameters
- mesh: Mesh
Axis gizmo mesh
- cache: GizmoAxisCache
Gizmo axis definition used for reactive gizmo UI
Returns void
- mesh: Mesh
dispose
-
Disposes of the gizmo
Returns void
get Axis Cache
-
Get the cache set with addToAxisCache for a specific mesh
Parameters
- mesh: Mesh
Axis gizmo mesh
Returns GizmoAxisCache | undefined
Gizmo axis definition used for reactive gizmo UI
- mesh: Mesh
release Drag
-
Force release the drag action by code
Returns void
set Custom Mesh
-
Disposes and replaces the current meshes in the gizmo with the specified mesh
Parameters
- mesh: Mesh
The mesh to replace the default mesh of the gizmo
Returns void
- mesh: Mesh
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
Gizmo that enables scaling a mesh along 3 axis