Class PositionGizmo
Hierarchy (View Summary)
- Gizmo
- PositionGizmo
Implements
Constructors
constructor
-
new PositionGizmo(
gizmoLayer?: UtilityLayerRenderer,
thickness?: number,
gizmoManager?: GizmoManager,
options?: PositionGizmoOptions,
): PositionGizmoCreates a PositionGizmo
Parameters
- gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer
The utility layer the gizmo will be added to
- thickness: number = 1
display gizmo axis thickness
OptionalgizmoManager: GizmoManagerOptionaloptions: PositionGizmoOptionsMore options
Returns PositionGizmo
- 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
x Gizmo
Internal gizmo used for interactions on the x axis
x Plane Gizmo
Internal gizmo used for interactions on the yz plane
y Gizmo
Internal gizmo used for interactions on the y axis
y Plane Gizmo
Internal gizmo used for interactions on the xz plane
z Gizmo
Internal gizmo used for interactions on the z axis
z Plane Gizmo
Internal gizmo used for interactions on the xy plane
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
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
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
planar Gizmo Enabled
-
get planarGizmoEnabled(): boolean
If the planar drag gizmo is enabled setting this will enable/disable XY, XZ and YZ planes regardless of individual gizmo settings.
Returns boolean
-
set planarGizmoEnabled(value: boolean): void
If the planar drag gizmo is enabled setting this will enable/disable XY, XZ and YZ planes regardless of individual gizmo settings.
Parameters
- value: boolean
Returns void
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
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
release Drag
-
Force release the drag action by code
Returns void
set Custom Mesh
-
CustomMeshes are not supported by this 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
Gizmo that enables dragging a mesh along 3 axis