class
HandleSlider
Base class for all handle sliders.
A handle slider is geometry that the user can interact with by selecting or dragging (sliding) it. Sliders generally output a one- or multi-dimensional delta value that signals the drag amount (and/or direction).
Public
Constructors
HandleSlider
Constructs a new handle slider.
- owner
- Object that that owns the slider.
- fixedScale
- If true the handle slider will always try to maintain the same visible area in the viewport regardless of distance from camera.
- layer
- Layer that allows filtering of which sliders are interacted with from a specific camera.
Methods
~HandleSlider
Intersects
Attempts to find an intersection between the provided ray and the slider geometry.
- screenPos
- Position in screen space at which to look for intersection. Some sliders might ignore this and use the instead.
- ray
- Ray in world space to try to interect with geometry.
- t
- Position of the intersection along the ray. Only if intersection happened.
Returns: Whether an intersection was detected.
HandleInput
Updates a slider that is currently active (being dragged).
- camera
- Camera through which we're interacting with the slider.
- inputDelta
- Pointer movement since the last time this method was called.
Update
Updates the state of the slider.
Must be called every frame.
- camera
- Camera through which we're interacting with the slider.
GetFixedScale
Returns if fixed scale is enabled.
If enabled the handle slider will always try to maintain the same visible area in the viewport regardless of distance from camera.
GetLayer
Returns a layer that determines which sliders are interacted with from a specific camera.
SetPosition
Sets the world position of the slider.
SetRotation
Sets the world rotation of the slider.
SetScale
Sets the scale of the slider.
SetEnabled
Enables or disables the slider, making it interactable or not.
GetPosition
Gets the world position of the slider.
GetRotation
Gets the world rotation of the slider.
GetScale
Gets the scale of the slider.
GetEnabled
Checks whether the slider can be interacted with or not.
Destroy
Makes the slider inactive.
Does not need to be called explicitly if the slider is deleted.
Protected
Methods
SetInactive
Toggles the slider state to inactive.
SetActive
Toggles the slider state to active.
- camera
- Camera through which the slider was activated.
- pointerPos
- Position of the pointer when the slider was activated.
SetHover
Toggles the slider state to hovered.
GetTransform
Gets the slider transform depending on set position, rotation and scale values.
GetTransformInv
Gets the inverse of the slider transform depending on set position, rotation and scale values.
Activate
Triggered when the slider state is changed to active.
Reset
Triggered when the slider state is changed from active to some other state.
UpdateCachedTransform
Updates the internal transform from the stored position, rotation and scale values.
CalcDelta
Calculates amount of movement along the provided ray depending on pointer movement.
- camera
- Camera on which the pointer movement is occurring.
- position
- Position of the ray to calculate movement on.
- direction
- Direction of the ray to calculate movement on. Must be normalized.
- pointerStart
- Starting position of the pointer when movement started, in pixels relative to provided camera.
- pointerEnd
- Current position of the pointer, in pixels relative to provided camera.