Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


PrimitiveBoundsHandle

Base class for a compound handle to edit a bounding volume in the Scene view.
Read time 2 minutesLast updated 13 days ago

Definition

public abstract class PrimitiveBoundsHandle

Remarks

This class allows you to display a shape with up to six control handles for simultaneously editing the size and center of a bounding volume. Dragging on any one control handle will expand the volume along the control handle's axis. All classes that inherit from this class also gain the following modifier keys while a control handle is being dragged:
• Alt: Pin the PrimitiveBoundsHandle.center of the volume to its location at the time the control handle was clicked and grow the size in both directions along the control handle's axis of movement.
• Shift: Uniformly scale the volume along all enabled PrimitiveBoundsHandle.axes in proportion to its size at the time the control handle was clicked.
The handle rendered by this class's PrimitiveBoundsHandle.DrawHandle() method is affected by global state in the Handles class, such as Handles.matrix and Handles.color.
Additional Resources: Editor.OnSceneGUI(), Handles.SetCamera.

Constructors

Constructor

Description

PrimitiveBoundsHandle()Create a new instance of the PrimitiveBoundsHandle class.

Properties

Property

Description

axesFlags specifying which axes should display control handles.
centerReturns or specifies the center of the bounding volume for the handle.
handleColorReturns or specifies the color of the control handles.
midpointHandleDrawFunctionAn optional Handles.CapFunction to use when displaying the control handles. Defaults to Handles.DotHandleCap if no value is specified.
midpointHandleSizeFunctionThe Handles.SizeFunction to specify how large the midpoint control handles should be.
wireframeColorReturns or specifies the color of the wireframe shape.

Methods

Method

Description

DrawHandleA function to display this instance in the current handle camera using its current configuration.
DrawWireframeDraw a wireframe shape for this instance. Subclasses must implement this method.
GetSizeGets the current size of the bounding volume for this instance.
IsAxisEnabledGets a value indicating whether the specified axis is enabled for the current instance.
OnHandleChangedA callback for when a control handle was dragged in the Scene.
SetColorSets PrimitiveBoundsHandle.handleColor and PrimitiveBoundsHandle.wireframeColor to the same value.
SetSizeSets the current size of the bounding volume for this instance.

Static Methods

Method

Description

DefaultMidpointHandleSizeFunctionA Handles.SizeFunction that returns a fixed screen-space size.

Enums

Enum

Description

PrimitiveBoundsHandle.AxesA flag enumeration for specifying which axes on a PrimitiveBoundsHandle object should be enabled.
PrimitiveBoundsHandle.HandleDirectionAn enumeration of directions the handle moves in.