class HandleSliderDisc

Inherits: HandleSlider

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

For intersection purposes the disc is internally represented by a torus.

Public

Constructors

HandleSliderDisc

HandleSliderDisc(const SPtr<SceneHandles> &owner, const Vector3 &normal, float radius, bool fixedScale = true, u64 layer = 1)

Constructs a new disc slider.

owner
Object that that owns the slider.
normal
Normal that determines the orientation of the disc.
radius
Radius of the disc.
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

~HandleSliderDisc

~HandleSliderDisc() 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.

SetCutoffPlane

void SetCutoffPlane(Degree angle, bool enabled)

Enables or disables a cut-off plane that can allow the disc to be intersected with only in an 180 degree arc.

angle
Angle at which to start the cut-off. Points on the dist at the specified angle and the next 180 degrees won't be interactable.
enabled
True to enable the cutoff plane, false otherwise.

GetDelta

Radian GetDelta() const

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

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

GetStartAngle

Radian GetStartAngle() const

Gets the initial angle at which the drag/slide operation started.

This is only valid when 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.

CalculateClosestPointOnArc

Vector3 CalculateClosestPointOnArc(const Ray &inputRay, const Vector3 &center, const Vector3 &up, float radius, Degree startAngle, Degree angleAmount)

Calculates the closest point on an arc from a ray.

inputRay
Ray to use for determining the point.
center
Center of the arc.
up
Normal vector of the arc. Must be normalized.
radius
Radius of the arc.
startAngle
Starting angle of the arc.
angleAmount
Length of the arc.

Returns: A point on the arc closest to the provided ray.

PointOnCircleToAngle

Degree PointOnCircleToAngle(Vector3 up, Vector3 point)

Determines an angle of a point on a circle.

up
Normal vector of the circle. Must be normalized.
point
Point to try to find the angle for. Caller must ensure the point is actually somewhere on the circle otherwise the result is undefined.

Returns: Angle at which the provided point lies on the circle.

Fields

mNormal

Vector3 mNormal

mRadius

float mRadius

mHasCutoffPlane

bool mHasCutoffPlane

mCutoffPlane

Plane mCutoffPlane

mDirection

Vector3 mDirection

mStartPosition

Vector3 mStartPosition

mStartAngle

Degree mStartAngle

mDelta

Degree mDelta

mCollider

Torus mCollider