class
HandleSlider2D
Handle slider that is positioned in screen-space, and reports 2D movement in screen space (in pixels).
When setting the position the Z coordinate will be ignored, and XY coordinates will be interpreted as pixels relative to the camera its viewed through.
Public
Constructors
HandleSlider2D
Constructs a new 2D slider.
- owner
- Object that that owns the slider.
- width
- Width of the area of the slider that can be interacted with, in pixels.
- height
- Height of the area of the slider that can be interacted with, in pixels.
- constraint
- Optional constraint that determines in which direction is the slider allowed to be
- layer
- Layer that allows filtering of which sliders are interacted with from a specific camera.
Methods
~HandleSlider2D
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.
GetDelta
Returns a delta value that is the result of dragging/sliding the pointer.
This changes every frame and will be zero unless the slider is active. The value is in screen space (pixels).
Protected
Methods
Activate
Triggered when the slider state is changed to active.
Reset
Triggered when the slider state is changed from active to some other state.