Tutorial Videos

5.3.Lever Components

5.4 Lever Components

 Overview

 A Lever component that allows movement on any axis, either one axis at a time or even multiple. You can set limits on how far the lever can travel and set a percentage point for when the lever will fire events. It can also lerp back to 0 or towards its min/max limits, among other things.

Examples

Door, handle, deadbolt, activation switch, gearbox, joystick

General Blueprint Workflow:

  1. Add a VRLever component to your desired blueprint or create a new component from the VRLever component class to use the same type of lever 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

All Current Lever Angles

Writes out all current angles to this rotator, useful mostly for dual axis modes (XY and Flight Stick XY).

Is Physics Lever

Legacy option where the lever works off of physics constraint. If true, the lever doesn’t have all features. Generally advised to leave this false.

Ungrip At Target Rotation

If true, force gripping controller to drop the lever when it reaches the toggle percentage (fires OnLeverStateChanged).

Lever Rotation Axis

Axis X – rotates only towards the X axis (roll)

Axis Y – rotates only towards the Y axis (pitch)

Axis Z – rotates only towards the Z axis (yaw)

Axis XY – rotates only on the X and Y axes

Flight Stick XY – acts like a flight stick, with AllCurrentLeverAngles being the positive / negative of the current full angle (yaw based on initial grip delta)

Lever Toggle Percentage

The percentage at which the lever will toggle between true and false states (fires event OnLeverStateChanged). The lever starts false and changes to true when reaching this percentage.

For example, if lever limit is 10 and toggle percentage is 0.5, the lever toggles at angle 5. If lever limit is 10 and toggle percentage is 0.1, the lever toggles at angle 1.

Note: Must be less than 1.0 to fire.

Lever Limit Positive

The max angle of the lever in the positive direction.

Note: When using single axis, if both positive and negative limits are set to 180, the lever has full 360 degrees of movement. With dual axis, only the positive limit is used and 180 degrees provides 360 degrees of movement.

Lever Limit Negative

The max angle of the lever in the negative direction.

Note: the negative limit is not used if the lever rotation axis is XY or Flight Stick XY.

Is Locked

If true then this lever is unable to be moved until unlocked again.

Can still be moved via code (SetLeverAngle).

Auto Drop when Locked

If true then this lever will auto drop any gripping controllers when locked.

Lever Return Type When Released

Stay – Stays in place

Return to Zero – Returns to 0 (lerps)

Lerp to Max – Lerps to closest limit (only works with single axis levers)

Lerp to Max if Over Threshold – Lerps to closest limit if over the toggle percentage threshold (only works with single axis levers)

Retain Momentum – Continues travelling on release (only works with single axis levers)

Send Lever Events During Lerp

Should lever events fire during lerp?

Lever Return Speed

The speed at which the lever lerps (when released from a grip).

Flight Stick Settings

Blend Axis Values By Angle Threshold

If true, then blend the values of the X and Y axes by the AngleThreshold, lowering Pitch/Yaw influence based on how far from leaning into the axis the lever is.

Angle Threshold

The angle threshold to blend around, default of 90.0 blends 0.0 to 1.0 smoothly across entire sweep

A value of 45 would blend it to 0 halfway rotated to the other axis, while 180 would still leave half the influence when fully rotated.

Momentum Settings

Frames to Average

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

Lever Momentum Friction

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

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

Lever Restitution

% of elasticity on reaching the lever’s limit.

At 0, the lever will stick. Values greater than 0 (max of 1) will have the lever bounce. Greater numbers = greater intensity.

Max Lever Momentum

Maximum momentum of the lever in degrees per second

Events

On Lever State Changed

Fires when the lever reaches the LeverTogglePercentage. Returns the following:

Lever Status – true when past the toggle percentage, false when not (initial state)

Lever Status Type – positive or negative

Lever Angle At Time – float

Full Lever Angle At Time – float

Lever Finished Lerping

Fires when the lever is set to lerp after release – provides:

Lever Final Angle – float

Functions

Re Calculate Current Angle

Allows you to manually recalculate the lever’s current angle. Can allow/disallow events to fire.

Reset Initial Lever Location

Sets the lever’s current location/rotation to be its new initial location/rotation. Also resets current angle. Can allow/disallow events to fire.

Set Lever Angle

Allows you to manually set the lever’s angle.

Inputs:

New Angle – the new angle to use, for single axis levers the sign of the angle will be used.

Dual Axis Forward Vector – only used with dual axis levers, you need to define which forward axis you want the New Angle to apply to.

 

Suggest Edit