Creates a new RotateGizmo object. Use Gizmo.createLayer to create the layer required to display the gizmo.
The camera component.
The layer responsible for rendering the gizmo.
Protected_Internal reference to the app containing the gizmo.
Protected_Internal reference to camera component to view the gizmo.
Protected_Internal version of coordinate space. Defaults to 'world'.
Protected_Internal reference to the graphics device of the app.
Protected_Internal list of app event handles for the gizmo.
Protected_Internal reference to layer to render the gizmo..
Protected_Internal array of mouse buttons that can interact with the gizmo.
Protected_Internal readout showing the transform delta while dragging.
Protected_Internal flag to track if a render update is required.
Protected_Internal gizmo starting rotation in world space.
Protected_Internal gizmo starting rotation in world space.
Protected_Internal version of the gizmo scale. Defaults to 1.
Protected_Internal currently selected axis.
Protected_Internal state of if currently selected shape is a plane.
Protected_Internal selection starting coordinates in world space.
Protected_Internal object containing the gizmo shapes to render.
Protected_Internal theme.
Whether to hide the shapes when dragging. Defaults to 'selected'.
The intersection shapes for the gizmo.
The graph nodes attached to the gizmo.
Flag to indicate whether to call preventDefault on pointer events.
The root gizmo entity.
The rotation mode of the gizmo. This can be either:
Whether snapping is enabled. Defaults to false.
Protected_Protected
Gets the angle guide line thickness.
Sets the angle guide line thickness.
Gets the camera component to view the gizmo.
ProtectedcameraProtected
Gets the center radius.
Sets the center radius.
Gets the gizmo coordinate space.
Gets the gizmo enabled state.
Sets the gizmo enabled state.
Gets the face ring radius.
Sets the face ring radius.
Gets the face tube radius.
Sets the face tube radius.
ProtectedfacingProtected
Gets the gizmo render layer.
Array of mouse buttons that can interact with the gizmo. The button indices are defined as:
The full list of button indices can be found here: https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
Gets whether to show the transform delta in a text readout just below the gizmo while dragging.
Sets whether to show the transform delta in a text readout just below the gizmo while
dragging. The readout is a div with the class gizmo-readout, added to the document body.
To show the value in a custom UI instead, turn this off and listen to
TransformGizmo.EVENT_TRANSFORMREADOUT. Defaults to true.
Gets the ring tolerance.
Sets the ring tolerance.
Gets the gizmo size.
Sets the gizmo size. Defaults to 1.
Gets the current theme for the gizmo.
Gets the XYZ ring radius.
Sets the XYZ ring radius.
Gets the XYZ tube radius.
Sets the XYZ tube radius.
Protected_Protected
The point.
The x coordinate.
The y coordinate.
The angle.
Protected_Protected
The axis to create the plane for.
Whether the axis is facing the camera.
Whether the axis is a line.
Protected_Protected_Protected
Protected_Protected_Protected_Protected
The point to project.
The axis to project to.
Protected_Protected
Formats a value for each of the axes being dragged.
The value for each axis.
Optionalfactor: boolean = false
Whether the values are factors rather than deltas. Defaults to false.
The readout markup.
Protected_Protected
Formats a delta with an explicit sign, so it does not read as an absolute value. A value that rounds to zero is shown as positive.
The value.
The number of digits after the decimal point.
The signed value.
Protected_Protected
Formats an axis letter in the axis color.
The axis.
The label markup.
Protected_Protected
The x coordinate.
The y coordinate.
The point (space is TransformGizmo#coordSpace).
Protected_Protected
Shows the readout centered below the visible gizmo shapes, which while dragging is the dragged handle.
The readout markup.
Protected_Protected
Protected_Protected
Protected_Protected
Set the shape to be enabled or disabled.
The shape axis.
The enabled state of shape.
Fire an event, all additional arguments are passed on to the event listener.
Name of event to fire.
Optionalarg1: any
First argument that is passed to the event handler.
Optionalarg2: any
Second argument that is passed to the event handler.
Optionalarg3: any
Third argument that is passed to the event handler.
Optionalarg4: any
Fourth argument that is passed to the event handler.
Optionalarg5: any
Fifth argument that is passed to the event handler.
Optionalarg6: any
Sixth argument that is passed to the event handler.
Optionalarg7: any
Seventh argument that is passed to the event handler.
Optionalarg8: any
Eighth argument that is passed to the event handler.
Self for chaining.
Test if there are any handlers bound to an event name.
The name of the event to test.
True if the object has handlers bound to the specified event name.
Get the enabled state of the shape.
The shape axis. Can be:
Detach an event handler from an event. If callback is not provided then all callbacks are unbound from the event, if scope is not provided then all events with the callback will be unbound.
Use this form to remove all listeners matching a name (and optionally callback/scope). To remove a single known subscription, prefer retaining the EventHandle returned by EventHandler#on / EventHandler#once and calling its EventHandle#off: it removes exactly that subscription and is faster (no scan of the callback list).
Optionalname: string
Name of the event to unbind.
Optionalcallback: HandleEventCallback
Function to be unbound.
Optionalscope: any
Scope that was used as the this when the event is fired.
Self for chaining.
const handler = () => {};
obj.on('test', handler);
obj.off(); // Removes all events
obj.off('test'); // Removes all events called 'test'
obj.off('test', handler); // Removes all handler functions, called 'test'
obj.off('test', handler, this); // Removes all handler functions, called 'test' with scope this
Attach an event handler to an event.
Name of the event to bind the callback to.
Function that is called when event is fired. Note the callback is limited to 8 arguments.
Optionalscope: any = ...
Object to use as 'this' when the event is fired, defaults to current this.
An event handle. For later removal, prefer retaining this handle and calling its EventHandle#off over EventHandler#off with a name/callback: it removes exactly this subscription and is faster (no scan of the callback list).
Attach an event handler to an event. The handler is removed before it is called, so it runs at most once, even if it fires the same event again or throws.
Name of the event to bind the callback to.
Function that is called when event is fired. Note the callback is limited to 8 arguments.
Optionalscope: any = ...
Object to use as 'this' when the event is fired, defaults to current this.
An event handle. For removal before it fires, prefer retaining this handle and calling its EventHandle#off over EventHandler#off with a name/callback: it removes exactly this subscription and is faster (no scan of the callback list).
Sets the theme or partial theme for the gizmo.
The partial theme to set.
Optionaldisabled?: Partial<Color>The disabled color.
OptionalguideBase?: Partial<{ x: Color; y: Color; z: Color }>The guide line colors.
OptionalguideOcclusion?: numberThe guide occlusion value. Defaults to 0.8.
OptionalshapeBase?: Partial<{ f: Color; x: Color; xyz: Color; y: Color; z: Color }>The axis colors.
OptionalshapeHover?: Partial<{ f: Color; x: Color; xyz: Color; y: Color; z: Color }>The hover colors.
StaticcreateCreates a new gizmo layer and adds it to the scene.
The app.
OptionallayerName: string = 'Gizmo'
The layer name. Defaults to 'Gizmo'.
OptionallayerIndex: number = app.scene.layers.layerList.length
The layer index. Defaults to the end of the layer list.
The new layer.
StaticEVENT_Fired when graph nodes are attached.
StaticEVENT_Fired when graph nodes are detached.
StaticEVENT_Fired when the pointer is down on the gizmo.
StaticEVENT_Fired when the pointer is moving over the gizmo.
StaticEVENT_Fired when the pointer is up off the gizmo.
StaticEVENT_Fired when the gizmo's position is updated.
StaticEVENT_Fired when the gizmo render has updated.
StaticEVENT_Fired when the gizmo's rotation is updated.
StaticEVENT_Fired when the gizmo's scale is updated.
StaticEVENT_Fired when the transformation has ended.
StaticEVENT_Fired during the transformation, with the dragged point on the selected axis or plane and the screen position of the pointer.
StaticEVENT_Fired with the value shown in the readout when the transformation starts and on each step of
it, whether or not TransformGizmo#readout is enabled, to show the value in a custom
UI. The handler is passed the selected axis, whether it is a plane, which moves along the
other two axes, and the value: the translation as a Vec3 for a translate gizmo, the scale
factor as a Vec3 for a scale gizmo, or the angle in degrees for a rotate gizmo. The Vec3
is reused, so copy it to keep it.
StaticEVENT_Fired when the transformation has started.
The RotateGizmo provides interactive 3D manipulation handles for rotating/reorienting Entitys in a Scene. It creates a visual widget with a draggable ring for each axis of rotation, plus a fourth ring for rotation in the camera's view plane, allowing precise control over object orientation through direct manipulation. The gizmo's visual appearance can be customized away from the defaults as required.
Note that the gizmo can be driven by both mouse+keyboard and touch input.
Relevant Engine API examples: