Usable Actions - Point And Shoot
In depth learning on Usable World Objects is found in this course in Motive Academy.
Overview
This article describes how to configure Motive > Usable Actions > Point And Shoot. Point And Shoot allows us to detect when a user points a tool and uses it on a predefined Object.
Step 1: Identify your Objects
For this example, I am going to use two Objects: a Cube as my Target, and a Cylinder as my Tool.
The first thing we want to do is make both of these Objects Motive Scene Objects. We will do this by right clicking the Object in the hierarchy, and then selecting Motive > Make Scene Object.
I will then give each of these a name, I will call my Cube=Target and my Cylinder=Tool
Step 2: Configure your tool
The next thing we want to do is add Point And Shoot to our Cylinder, we will do this my right clicking the Object in the hierarchy and then selecting Motive > Usable Actions > Point And Shoot. You will notice that this adds a number of components to our Object including VR Grabbable, Usable World Object, and Usable Point Click Action.
Now we want to set up where we want to output our raycast from the Cylinder. To do this, we will right click our Object in the hierarchy and create an empty child, let's name this raycast.
Then, we will move the transform to the end of Cylinder and orient it with the blue arrow pointing the direction we want to cast.
Now let's drag Raycast into the Raycast transform box of the Usable Point Click Action.
While we are here, let's add some haptic feedback and lower the distance down to one.
Finally, let's add a grab anchor to the Cylinder to make it easier to hold. Again let's right click it in the hierarchy, and create empty, this time let's name it Grab Anchor.
let's move the grab anchor to the base of the Cylinder. To orient it in our hand, imagine the green arrow points up, the red arrow points right, and the blue arrow points forward. Since we want to point with the Cylinder, let's orient the blue arrow towards the top.
Next we drag the Grab Anchor into the Grab Anchor box of VR Grabbable
Step 3: Unity Test 1
Now if we start our Unity scene we can pick up our Cylinder, we can see we are holding it pointing away from us and if we pull the trigger we can feel haptic feedback.
For now this is all that it will do. To add the rest of the behaviour, we will move over to Storyflow.
Step 4: Storyflow
First thing we want to do is add our Motive Scene Objects to a Catalog. Create a Catalog named My Objects, and to this Catalog we will add Target and Tool.
Open the relevant Script or create a Script
In a new frame, add the Use Tool Resource.
For the World Object we will select Target, and for Use Tool we will select Tool.
Add an Event "complete" and in this final Frame we can add a Screen Message Resource (Playable Content type),
Give it the title of Detected!
Link the Script you created to the Scenario
Step 5: Unity Test 2
Now back in Unity, let's run the script.
When we grab the Cylinder it should be pointing away from us, and when we squeeze the trigger we should feel some haptic feedback in our controller.
At a distance, pointing towards the target and pulling the trigger wont display our message, but if we come within range, we see that it does.
Related Articles
Configure One Object to be Used On Another
Â
Â