Requiring a tool with the Use Interactable At condition¶
In this tutorial, we are going to add a Condition to to an action in the Neuromonitoring Sample. This condition will require that the user holds the tweezers on a certain part of the anatomy, in order for it to complete.
Step 1: Setup¶
Import Sample¶
To import the sample, open the panel via ORamaVR Creator > Panel, and import the
Neuromonitoring Sample in the samples section.
Open Scene Graph¶
Next, in the scene view, open the scene graph via the “SceneGraph” button listed on the bottom left.
Navigate to the “Fat Incision” action inside the graph (2nd action). This is where we’re going to add our new condition. We essentially want the action to perform only if the
Note that all conditions are action-agnostic. They can be used on any action in the scene graph (including any custom action created via script).
In the image above both the action in the scene graph, and the tool we’re going to use are depicted.
Step 2: Create Condition¶
Open Conditions¶
In the top-right of the action, press the “conditions button” (as shown in image).
This will open the conditions of this action.
Multiple conditions (even duplicates of the same type) can be added here. Each condition has 2 general flags (with an optional third one).
Flag |
Description |
|---|---|
Fail |
Fails the action if the condition is not met |
Negate |
Negates the result of the condition. If the condition has failed, then it will have the opposite result and vice versa. |
Critical |
(Only usable if “Fail” is checked) |
Add Condition¶
Press the “Add Condition button”, and select the “Use Interactable At” choice.
Configure Condition¶
Next, we’ll configure some options for the condition:
In the description field, we’ll add some memorable name for it
In the Interactable Object field, we will set it to the “Anatomical Forceps” prefab. It’s located in “Assets/Samples/ORamaVR Creator - Core/5.5.5/Neuromonitoring Scene/Resources/Prefabs/Tools/Anatomical Forceps/”
At the very bottom, we’ll check “Require Activation”. This makes sure that the user closes the forceps at the designated location
Create Collision Area Prefab¶
As you may have noticed, we have not completed filling out the condition. We need to define an area in which the user needs to apply the forceps. We will do this by creating a cube collider.
Right-click on the scene hierarchy panel, and click on 3D Object > Cube
At this point, we’ll disable rendering on the cube by selecting it in the hierarchy panel, and removing the “Mesh Filter” and “Mesh Renderer” components from the inspector on the right hand side.
Place the cube where you would like it to be. Additionally, you can add more colliders under it to facilitate more complex cases.
As shown above, we place it near where we would like the skin layer to be held, during the “Fat Incision” action.
Once you’re satisfied with your placement, you can convert this cube to a prefab by dragging it into the “Project” folder.
Note
Make sure to pick a place that is inside of a “Resources” folder. Otherwise, Co-Op features may not work correctly.
Afterwards, drag into the corresponding field inside the condition.
Result¶
Save & close the scene graph, and now the action will only pass if the condition is met
See also
Conditions for the shared flags, the possible outcomes, and the other built-in condition types.