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.
- 1 Overview
- 1.1 Lever Hinge
- 1.1.1 Rigidbody
- 1.1.2 Hinge Joint
- 1.2 VR Grabbable
- 1.3 Joint Effects
- 1.4 Usable World Object
- 1.5 Joint Boolean State Setter
- 1.6 Motive Scene Object
- 1.7 Lever Object
- 1.7.1 Collider
- 1.1 Lever Hinge
- 2 Related Articles
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 |
---|---|
Use Gravity | false |
Is Kinematic | true |
Collision Detection | Continuous Speculative |
Hinge Joint
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 |
---|---|
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 |
---|---|
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 |
---|---|
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 |
---|---|
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 |
---|---|
Trigger | Generally true unless this item needs physics |
Related Articles