Lever

In depth learning on Scene Configuration can be found in this course in Motive Academy.

Use a grabbable and a hinge Joint to create a lever with limited motion.

 

Overview

Create a lever on an object activated by grabbing. Levers need to move from a pivot position properly so ensure this is set up properly (VR Grabbables & Unity Joints)

 

Lever Hinge

Gameobject contains the Hinge Joint and VR Grabbable logic.

Rigidbody

Field

Value

Field

Value

Use Gravity

false

Is Kinematic

true

Collision Detection

Continuous Speculative

Hinge Joint

Field

Value

Field

Value

Axis + Secondary axis

Adjust identity matrix to pivot on desired axis

Connected Rigidbody

Rigidbody of main/body object

Limit Rotation

true

Lower Rotation

Desired negative degrees from rest position

Upper Rotation

Desired positive degrees from rest position

negative/positive degrees = direction of rotation

VR Grabbable

Field

Value

Field

Value

Allow Distance Grab

false

Snap Position

Never

Snap Orientation

Never

Grab points

Collider(s) the user will be grabbing

Release Behaviour

Leave and Reset Rigidbody

Move Mode

Physics

Joint Effects

Used to fire SFX/Haptics on upper/lower limit events

Field

Value

Field

Value

Lower Limit Reached - Haptic Effect

Bump (VRHapticEffect)

Upper Limit Reached - Haptic Effect

Bump (VRHapticEffect)

Usable World Object

Required to connect to the “use object” input for object interactions.

Field

Value

Field

Value

On Use

Connect to any animations, SFX, etc. required for the action.

Joint Boolean State Setter

Binds the hinge Joint to a Boolean Behaviour State. In this case, sets the state to “true” when the lever is at the lower limit.

Field

Value

Field

Value

State

Whatever name you want to use as a variable when authoring

Lower Limit State Setting

true

Upper Limit State Setting

false

Motive Scene Object

Required for Scene Objects, can be skipped if deploying as an asset.

Lever Object

The prefab of the lever itself with mesh renderers + colliders.

Collider

If possible use a primitive collider, unless you’re sure the user may only grab the object on the lever handle alone.

Field

Value

Field

Value

Trigger

Generally true unless this item needs physics

Related Articles