Class AxisDragGizmo
Hierarchy (View Summary)
- Gizmo
- AxisDragGizmo
Implements
Constructors
constructor
-
new AxisDragGizmo(
dragAxis: Vector3,
color?: Color3,
gizmoLayer?: UtilityLayerRenderer,
parent?: Nullable<PositionGizmo>,
thickness?: number,
hoverColor?: Color3,
disableColor?: Color3,
): AxisDragGizmoCreates an AxisDragGizmo
Parameters
- dragAxis: Vector3
The axis which the gizmo will be able to drag on
- color: Color3 = ...
The color of the gizmo
- gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer
The utility layer the gizmo will be added to
- parent: Nullable<PositionGizmo> = null
- thickness: number = 1
display gizmo axis thickness
- hoverColor: Color3 = ...
The color of the gizmo when hovering over and dragging
- disableColor: Color3 = ...
The Color of the gizmo when its disabled
Returns AxisDragGizmo
- dragAxis: Vector3
Properties
_ root Mesh
The root mesh of the gizmo
drag Behavior
Drag behavior responsible for the gizmos dragging interactions
gizmo Layer
[Object] The utility layer the gizmo will be added to
on Snap Observable
Event that fires each time the gizmo snaps to a new location.
- snapDistance is the change in distance
snap Distance
Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)
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
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
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
is Enabled
-
get isEnabled(): boolean
If the gizmo is enabled
Returns boolean
-
set isEnabled(value: boolean): void
If the gizmo is enabled
Parameters
- value: boolean
Returns void
is Hovered
-
get isHovered(): boolean
True when the mouse pointer is hovered a gizmo mesh
Returns boolean
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
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
Single axis drag gizmo