Tutorial Videos

5.4.Slider Components

5.3 Slider Components

 Overview

A VRSlider is a component you can add to any actor. It is a static mesh that can be moved on any axis. It can also be set to follow along any spline (can follow rotation/scale settings of the slider as well).

Examples

Volume slider, lots of weapon uses like pumps, racks, and adapter rails, or even a train you can move along a track.

General Blueprint Workflow:

  1. Add a VRSlider component to your desired blueprint or create a new component from the VRSlider component class to use the same type of slider in multiple blueprints.
  2. Set the static mesh
  3. Adjust the details of the component.
  4. Use the events, functions, and variables to create your desired logic.

Settings

Update in Tick

If true then this slider will only update in its tick event instead of normally using the controller’s update event.

Keep in mind that you then must adjust the Tick Group in the Component Tick settings to make sure it happens after the gripping controller.

 

This can help with instances of the slider not moving as intended. For example, if a slider is used as the fore-end of a pump shotgun, you may need to enable this and set the tick group of the slider to be after the gripping controller to prevent unwanted movement.

Max Slide Distance

Maximum travel distance in the slider’s relative positive direction.

 

Note: values are absolute (negative or positive both result in a positive value).

Min Slide Distance

Maximum travel distance in the slider’s relative negative direction.

 

Note: values are absolute (negative or positive both result in a positive value).

Slider Behavior when Released

Stay – slider remains where it was when released

Retain Momentum – slider keeps travelling based on velocity when released

Current Slider Progress

A float value between 0.0 and 1.0 that represents the slider’s position between its min and max distances (or end/start of spline it follows). 0 = at minimum, 1 = at maximum. Can be edited during runtime with the function Set Slider Progress. Can be manually recalculated at will with function Calculate Slider Progress.

Slide Distance is in Parent Space

Should the slider use its parent actor’s scale. If true (default), the slider’s scale has no effect on the slider min/max distances.

If false, the min/max limits adjust based on the slider’s scale values (if the limit of max distance is set to 100 and the slider is scaled down to 0.5, the limit with this false will be 50).

Is Locked

If true, this slider cannot be gripped until unlocked again (can still be moved via code).

Auto Drop When Locked

If true then this slider will auto drop grips when locked.

If you set the slider to lock while being gripped, the gripping hand will be forced to drop the grip.

Use Legacy Logic

Setting this to true will make it so that negative min/max distance limits are actually negative. This is not officially supported (slider may not throw events/move as intended) and only exists for the benefit of those who already have their sliders setup this way.

Event Throw Threshold

A number between 0 and 1 determining how far the slider must progress between its min/max distances before allowing the same event to fire.

For example, with a setting of 0.5, a slider that reached 1.0 (current slider progress) must then reach 0.5 progress before it will fire events on 1.0 again.

Spline Component to Follow

Set this to assign a spline component to the slider. Forces the slider to follow along the spline. Slider progress is calculated where 0 = the spline’s first point (0) and 1 = the last spine point.

Follow Spline Rotation and Scale

Should the slider follow the rotation and scale of the spline.

If true, when the spline changes scale or rotation, the slider will as well.

Enforce Spline Linearity

Does not allow the slider to skip past nodes on the spline, it requires it to progress from node to node.

For example, a spline with a closed loop will not allow the slider to be moved from 0 to 1 unless it travels through the entire loop.  

Spline Lerp Type

Type of lerp to use when following a spline (how it chooses which point the slider should be in between spline points)

Lerp None = slider follows along spline normally

Lerp Interp = speed changes based on distance (with my examples I can only see it being slower than the other options?)

Lerp ConstantTo = the suggested method in general as it will be the smoothest. Also allows use of the Spline Lerp Value.

Spline Lerp Value

Lerp Value for the spline, when in InterpMode it is the speed of interpolation. A setting of 0 results in no movement.

Note: Only used when Spline Lerp Type is set to Constant to.

Slider Uses Snap Points

Set to true to enable use of snap increments to move between.

 

Note: not compatible with Slide Behavior When Released = Retain Momentum.

Snap Increment

Portion of the slider that the slider snaps to on release and when within the threshold distance

Snap Threshold

Threshold distance that when within the slider will stay snapped to its current snap increment

Increment Progress Between Snap Points

If true then the slider progress will keep incrementing between snap points if outside of the threshold, however events will not be thrown

Momentum Settings (only for sliders set to retain movement on release)

Frames to Average

Number of frames to average momentum across for the release momentum (having some frames averaged avoids quick waggles).

Slider Momentum Friction

Units in % of total length per second to slow a momentum lerp down.

Essentially this is how quickly the slider will slow to a stop after being released. Lower numbers make it take longer to stop (like a really light/slick object), higher numbers make it stop quicker (like a heavy/sticky object).

Slider Restitution

% of elasticity on reaching the start or end of the slider’s distance or spline.

At 0, the slider will stick to the start/end of the spline. Values greater than 0 (max of 1) will have the slider bounce. Greater numbers = greater intensity.

Note: for sliders that follow splines only

Max Slider Momentum

Maximum momentum of the slider in units of total distance per second.

At 0, the slider will act as if it is set to Stay on release. Higher numbers = higher speed. 1 is default.

Events

On Slider Hit Point

With Snap Points Off, fires when the slider progress hits 0 or 1. With Snap Points on, fires at every Snap Increment.

On Slider Finished Lerping

Fires when the slider stops moving after release with momentum.

Note: slider must be set to Retain Momentum for this to fire.

Event will not fire unless slider has ceased movement completely (small changes may not be visible to the naked eye (check relative location to see movement).

Functions

Calculate Slider Progress

Calculates the current slider progress (a 0.0 to 1.0 number as to where in between the min/max distance or start end of a spline the slider is).

Reset Initial Slider Location

Tells the slider that wherever it currently is = its initial location. Sets slider progress to 0 and adjusts min/max distances to reflect the new location.

Note: has no effect on sliders that follow spline components.

Set Slider Progress

Allows you to adjust the slider’s progress without gripping.

Set Spline Component to Follow

Sets the slider to follow a spline component.

Note: slider progress is not automatically called with this function, so if you use this function during runtime and want the slider progress to update, call Calculate Slider Progress directly after. Otherwise, slider progress will update on next grip.

 

Suggest Edit