VR Interaction Framework v2.0
Loading...
Searching...
No Matches
BNG.Lever Class Reference

Helper class to interact with physical levers. More...

Inheritance diagram for BNG.Lever:

Public Member Functions

virtual float GetAnglePercentage (float currentAngle)
 
virtual void SetLeverAngle (float angle)
 Sets the X local euler angle of the lever. Angle is capped by MinimumXRotation / MaximumXRotation.
 
virtual void OnLeverChange (float percentage)
 
virtual void OnLeverDown ()
 Lever Moved to down position.
 
virtual void OnLeverUp ()
 Lever moved to up position.
 

Public Attributes

float MinimumXRotation = -45f
 
float MaximumXRotation = 45f
 
float InitialXRotation = 0f
 
AudioClip SwitchOnSound
 
AudioClip SwitchOffSound
 
float SwitchTolerance = 1.25f
 Tolerance before considering a switch flipped On or Off Ex : 1.25 Tolerance means switch can be 98.25% up and considered switched on.
 
bool UseSmoothLook = true
 
float SmoothLookSpeed = 15f
 
bool AllowPhysicsForces = true
 If false, the lever's rigidbody will be kinematic when not being held. Disable this if you don't want your lever to interact with physics or if you need moving platform support.
 
bool ReturnToCenter = true
 If ReturnToCenter true and KinematicWhileInactive true then the lever will smooth look back to center when not being held.
 
float ReturnLookSpeed = 5f
 How fast to return to center if not being held.
 
bool SnapToGrabber = false
 If true the lever will look directly at the Grabber and not factor in an initial offset.
 
bool DropLeverOnActivation = false
 
float LeverPercentage
 Current position of the lever as expressed as a percentage 1-100.
 
bool ShowEditorGizmos = true
 
UnityEvent onLeverDown
 Called when lever was up, but is now in the down position.
 
UnityEvent onLeverUp
 Called when lever was down, but is now in the up position.
 
FloatEvent onLeverChange
 Called if the lever changes position at all.
 

Detailed Description

Helper class to interact with physical levers.

Member Function Documentation

◆ GetAnglePercentage()

virtual float BNG.Lever.GetAnglePercentage ( float  currentAngle)
virtual

◆ OnLeverChange()

virtual void BNG.Lever.OnLeverChange ( float  percentage)
virtual

◆ OnLeverDown()

virtual void BNG.Lever.OnLeverDown ( )
virtual

Lever Moved to down position.

◆ OnLeverUp()

virtual void BNG.Lever.OnLeverUp ( )
virtual

Lever moved to up position.

◆ SetLeverAngle()

virtual void BNG.Lever.SetLeverAngle ( float  angle)
virtual

Sets the X local euler angle of the lever. Angle is capped by MinimumXRotation / MaximumXRotation.

Parameters
angle

Member Data Documentation

◆ AllowPhysicsForces

bool BNG.Lever.AllowPhysicsForces = true

If false, the lever's rigidbody will be kinematic when not being held. Disable this if you don't want your lever to interact with physics or if you need moving platform support.

◆ DropLeverOnActivation

bool BNG.Lever.DropLeverOnActivation = false

◆ InitialXRotation

float BNG.Lever.InitialXRotation = 0f

◆ LeverPercentage

float BNG.Lever.LeverPercentage

Current position of the lever as expressed as a percentage 1-100.

◆ MaximumXRotation

float BNG.Lever.MaximumXRotation = 45f

◆ MinimumXRotation

float BNG.Lever.MinimumXRotation = -45f

◆ onLeverChange

FloatEvent BNG.Lever.onLeverChange

Called if the lever changes position at all.

◆ onLeverDown

UnityEvent BNG.Lever.onLeverDown

Called when lever was up, but is now in the down position.

◆ onLeverUp

UnityEvent BNG.Lever.onLeverUp

Called when lever was down, but is now in the up position.

◆ ReturnLookSpeed

float BNG.Lever.ReturnLookSpeed = 5f

How fast to return to center if not being held.

◆ ReturnToCenter

bool BNG.Lever.ReturnToCenter = true

If ReturnToCenter true and KinematicWhileInactive true then the lever will smooth look back to center when not being held.

◆ ShowEditorGizmos

bool BNG.Lever.ShowEditorGizmos = true

◆ SmoothLookSpeed

float BNG.Lever.SmoothLookSpeed = 15f

◆ SnapToGrabber

bool BNG.Lever.SnapToGrabber = false

If true the lever will look directly at the Grabber and not factor in an initial offset.

◆ SwitchOffSound

AudioClip BNG.Lever.SwitchOffSound

◆ SwitchOnSound

AudioClip BNG.Lever.SwitchOnSound

◆ SwitchTolerance

float BNG.Lever.SwitchTolerance = 1.25f

Tolerance before considering a switch flipped On or Off Ex : 1.25 Tolerance means switch can be 98.25% up and considered switched on.

◆ UseSmoothLook

bool BNG.Lever.UseSmoothLook = true

The documentation for this class was generated from the following file: