Api Sandbox Gizmo
class

Gizmo

public static abstract sealed class Gizmo

Properties

Name Type Description
Control static GizmoControls Holds fully realized controls to manipulate some value
Draw static GizmoDraw Draw a shape using the gizmo library
World static SceneWorld
PreviousRay static Ray
CurrentRay static Ray
RayDepth static Single
ControlMode static String
Transform static Transform
Path static String
Object static Object
Camera static SceneCamera
IsHovered static Boolean
IsSelected static Boolean
IsChildSelected static Boolean
WasClicked static Boolean
HasSelected static Boolean
HasHovered static Boolean
HasClicked static Boolean
HasMouseFocus static Boolean
CursorPosition static Vector2 The current cursor position, in screen space
CursorMoveDelta static Vector2 The delta of cursor movement between this frame and last, in screen space
CursorDragDelta static Vector2 The delta of cursor movement between last press and now, in screen space. If left mouse isn't down, will return CursorMoveDelta
KeyboardModifiers static KeyboardModifiers The current keyboard modifiers
IsCtrlPressed static Boolean
IsShiftPressed static Boolean
IsAltPressed static Boolean
WasLeftMouseReleased static Boolean
IsLeftMouseDown static Boolean
WasLeftMousePressed static Boolean
WasRightMouseReleased static Boolean
IsRightMouseDown static Boolean
WasRightMousePressed static Boolean
IsDoubleClicked static Boolean
CameraTransform static Transform The cameras transform - in world space
LocalCameraTransform static Transform The cameras transform - in local space
IsPressed static Boolean
HasPressed static Boolean
PressRay static Ray
Settings static SceneSettings
Hitbox static GizmoHitbox Allows creating a gizmo hitbox which will be interactable using the mouse (or vr deck2 super controller)

Methods

static Void EndInstance(Instance previous)
static Void Select(Boolean allowUnselect = True, Boolean allowMultiSelect = True)
static IDisposable Scope(String path, Transform tx)

Create a new scope - any changes to colors and transforms will be stored and reverted when exiting the scope.

static IDisposable Scope(String path, Vector3 position)

Create a new scope - any changes to colors and transforms will be stored and reverted when exiting the scope.

static IDisposable Scope(String path, Vector3 position, Rotation rotation, Single scale = 1)

Create a new scope - any changes to colors and transforms will be stored and reverted when exiting the scope.

static IDisposable Scope(String path = null)

Create a new scope - any changes to colors and transforms will be stored and reverted when exiting the scope.

static IDisposable ObjectScope(T obj, Transform tx)

Create a new scope - any changes to colors and transforms will be stored and reverted when exiting the scope.

static Vector3? GetPositionOnPlane(Vector3 position, Vector3 planeNormal, Ray ray)

Get the distance from a point on a plane

static Vector3 GetMouseDelta(Vector3 position, Vector3 planeNormal)

Get the mouse delta at this current position

static Vector3 GetMouseDrag(Vector3 position, Vector3 planeNormal)

Get the mouse drag distance at this current position, assuming we are pressed

static Vector3 GetMouseDistanceVector(Vector3 position, Vector3 planeNormal)

Get the vector distance from a point on a plane

static Single GetMouseDistance(Vector3 position, Vector3 planeNormal)

Get the distance from a point on a plane

static Single GetMouseDistanceDelta(Vector3 position, Vector3 planeNormal)

Get the distance moved from (or towards) a position on a plane

static Vector3 Snap(Vector3 input, Vector3 movement)

Will snap this position, depending on the current snap settings and keys that are pressed. Will snap along if movement is detected along that axis. For example, if movement is 1,0,0 then we'll only snap on the x axis.

static Angles Snap(Angles input, Angles movement)

Will snap this position, depending on the current snap settings and keys that are pressed. Will snap along if movement is detected along that axis. For example, if movement is 1,0,0 then we'll only snap on the x axis.

static Rotation Snap(Rotation rotationDelta)

Snaps a rotation delta to angle increments.

rotationDelta — The rotation delta to snap
returns — A snapped rotation that aligns to the angle grid
static BBox Snap(BBox startBox, BBox movement)

Applies snapping to a box being resized using delta tracking. Returns a properly snapped box.

startBox — The original box before resizing began
movement — The accumulated delta changes
returns — A new snapped box with proper minimum dimensions
static Vector3 Nudge(Rotation rotation, Vector2 direction)

Will give you a nudge vector along the most aligned left and up axis of the rotation based on left/right/up/down direction and camera angle

Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.Gizmo