OvidVR Interactable Item¶
The most important script the developer needs from the OvidVRPhysX is the ovidVRInteractableItem. When attached to an object it enables physics interactions to the object it is attached to.
More specifically, for an object to have physics interactions inside Unity, it is easy for the developer. Create colliders, add rigidbody and enable gravity. But if grabbing the object is implemented from the developers with the Unity’s default method, parenting, upon grabbing, that object will lose its physics properties (e.g. it won’t collide with object - passing through them).
Instead of parenting, the ovidVR Platform provides this script for the developers to use. It is responsible for the object to be able to be grabbed from the user while maintaining its physical properties.
Parameters explained below:
Parameter |
Description |
---|---|
Can Attach |
object can/can’t be attached to the user’s virtual hands |
Disable Kinematic On Attach |
if true, when attached to a hand it will disable its kinematic properties to re-enable objects physics interactions. |
Enable Kinematic On Attach |
if true, when released the object from users hands its kinematic properties will be re-enabled. (See Unity’s documentation for more information on kinematic). |
Drop Distance |
set a distance margin between hand and object. When their distance is greater than the margin, the interaction will stop. Very useful for two hand interaction. |
Enable Gravity On Detach |
if true, when released the object from users hands its gravity will be turned back on. |
Two handed |
if true it can be grabbed with both hands. Still experimental it can produce a large pivot between hands, use with caution. |
Disable Physical materials On Attach |
if a physical material is attached on the gameobject, it will be disabled on attach to avoid any influence in the interaction. |
On Begin Interaction (Unity Action) |
functions can be added here. They will be called when the user will grab the object. |
On End Interaction (Unity Action) |
functions can be added here. Upon objects release from the user, these functions are going to be used. |
Interaction Point L & R |
fixed points on the object used for snapping the object to that position and rotation on attach. More specifically, when grabbed, the object will keep its transform relative to the hand upon grasping. The developer can create specific positions and rotations for the object (for each hand) using different gameobjects as children of that object in question. If these transforms are given into these variables, the object upon grasping will automatically be changed in terms of transform to match these interactive points given. |