public sealed class TransformGizmoThe handles that move, turn and resize what is selected.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Every drag is recomputed from where it started, never accumulated. The gizmo records what each target held on mouse-down and applies the whole of the drag to that, which is what makes snapping land on the grid rather than near it, makes a drag that goes out and comes back end where it began, and makes floating-point drift impossible instead of merely small. An implementation that adds each frame's delta to the current value has all three bugs and none of them are reproducible.
It is arithmetic over an interface, with no renderer in it. What the handles look like belongs to the viewport; where they are, what is under the pointer and what a drag means are here, so all of it is testable with no device.
⚠ The handles are a constant size on screen. A gizmo in world units is a dot at forty metres and fills the viewport at half a metre. Everything below that is measured in world units is scaled by WorldPerPixel, which is the one place the camera's distance enters the arithmetic.
Fields and properties (26)
public float HandleLengthHow long an arm is, in render pixels.
public float GrabRadiusHow near the pointer has to be to an arm to grab it, in render pixels.
public float ThicknessHow thick the handles are drawn, in render pixels.
public float PlaneOffsetHow far along the arms the plane quads sit, as a fraction of the arm.
public float PlaneSizeHow big the plane quads are, as a fraction of the arm.
public float CentreRadiusHow big the middle box is, in render pixels.
public float ScreenRingScaleHow far out the screen-facing rotation ring sits, as a fraction of the arm.
public float HeadLengthHow long an arm's head is, as a fraction of the arm.
public float HeadRadiusHow wide an arm's head is, as a fraction of the arm.
public float ArmStartHow far along an arm its grabbable part starts, as a fraction of the arm.
public float MinimumAxisLengthHow short an arm may look before it stops being offered, in render pixels.
public float EdgeOnLimitHow nearly a rotation ring may be edge-on before its drag is measured along the screen instead of in its own plane, as the cosine of the angle to the view direction.
public GizmoMode ModeWhat the gizmo changes.
public GizmoSpace SpaceWhich axes the handles point along.
public PivotMode PivotWhere the handles sit when several things are selected.
public SnapContext SnapWhat a drag rounds to.
public GizmoHandle HoveredThe handle the pointer is over, if any.
public GizmoHandle ActiveThe handle being dragged, if any.
public bool IsDraggingWhether a drag is under way.
public IReadOnlyList<IGizmoTarget> TargetsWhat the gizmo is moving, in selection order.
public float ToleranceHow near the pointer has to be to a handle to grab it, in render pixels.
public Vector3 OriginWhere the handles sit, in world space.
public SnapHit? SnapToWhere a translate drag has been told to put the gizmo's origin, instead of where the pointer says.
public Vector3 SnapOriginWhich point of what is being dragged a snap puts on the target.
public TypedTransform? TypedAn exact transform typed during the drag, instead of the one the pointer says.
public (GizmoMode Kind, Vector3 Offset, float Scalar) DraggedWhat the drag has done so far, for a readout to show.
Methods (10)
public void Attach(IEnumerable<IGizmoTarget> selection)Points the gizmo at a selection.
public Matrix4x4 Basis(EditorCamera camera)Which way the arms point.
public float WorldPerPixel(EditorCamera camera, int height)How many world units one render pixel is, at the gizmo's origin.
public bool IsAxisVisible(Vector3 axis, EditorCamera camera)Whether an arm along a direction is long enough on screen to be worth offering.
public GizmoHandle HitTest(Vector2 point, EditorCamera camera, int width, int height)Which handle is under a point.
public bool Begin(GizmoHandle handle, Ray ray, EditorCamera camera)Starts a drag.
public bool Drag(Ray ray, EditorCamera camera)Applies the whole of the drag so far.
public void End()Ends the drag, leaving everything where it is.
public bool Cancel()Ends the drag and puts everything back where it started.
public IReadOnlyList<(Vector3 Position, Quaternion Rotation, Vector3 Scale)> Captured()What each target held when the drag began, for the undo command.
Used by (16)
- EditorAffordanceTestsVixen.Editor.App.Tests
- EditorApplicationVixen.Editor.App
- GizmoGeometryVixen.Editor.SceneView
- GizmoGeometryTestsVixen.Editor.SceneView.Tests
- GizmoTestsVixen.Editor.SceneView.Tests
- ManipulationTestsVixen.Editor.SceneView.Tests
- OneEditPathTestsVixen.Editor.App.Tests
- PrecisionTestsVixen.Editor.SceneView.Tests
- ProxyShapeEditorTestsVixen.Editor.AssetEditors.Tests
- SceneViewportVixen.Editor.SceneView
- SnapCommandTestsVixen.Editor.App.Tests
- SnapContextTestsVixen.Editor.SceneView.Tests
- SnapTestsVixen.Editor.SceneView.Tests
- ViewportChromeVixen.Editor.App
- ViewportInputTestsVixen.Editor.SceneView.Tests
- WorkPlaneCommandTestsVixen.Editor.App.Tests