class HandleSliderLine

Inherits: HandleSlider

Handle slider that returns a delta value as you drag the pointer along a line.

For intersection purposes the line is internally by a capsule and a sphere at its cap (assuming this will be used for arrow-like handles).

Public

Constructors

HandleSliderLine

HandleSliderLine(const SPtr<SceneHandles> &owner, const Vector3 &direction, float length, bool fixedScale = true, u64 layer = 1)

Constructs a new line slider.

owner
Object that that owns the slider.
direction
Direction of the line.
length
Length of 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

~HandleSliderLine

~HandleSliderLine() noexcept

Intersects

bool Intersects(const Vector2I &screenPos, const Ray &ray, float &t) const override

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

void HandleInput(const HCamera &camera, const Vector2I &inputDelta) override

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

float GetDelta() const

Returns a delta value that is the result of dragging/sliding the pointer along the line.

This changes every frame and will be zero unless the slider is active.

Protected

Methods

Activate

void Activate(const HCamera &camera, const Vector2I &pointerPos) override

Triggered when the slider state is changed to active.

Reset

void Reset() override

Triggered when the slider state is changed from active to some other state.

Fields

mDirection

Vector3 mDirection

mLength

float mLength

mDelta

float mDelta

mStartPosition

Vector3 mStartPosition

mCapsuleCollider

Capsule mCapsuleCollider

mSphereCollider

Sphere mSphereCollider