A very common VR interaction is the use of the controller to point at objects in space and interact with them.  In Alice we translate the mouse click event directly to this behavior.  The standard in VR is that when this functionality is available a ray will extend from the controller to indicate where the handset is pointed to help with the selection.  This visual cue will only appear in Alice when this functionality is programmed into the world.

Setting Up a Point and Click Event

To set up the point and click mechanic follow the same pattern for setting up a mouse click event:

1. Go to the code editor
2. Navigate to the initializeEventListeners tab
3. Select add event listener > Mouse > addMouseClickOnObjectListener
4. To limit the objects that will trigger the event select add detail > Set of Visuals >Custom Array
5. Add the objects you want to trigger this event 
6. Add code to the event for the resulting outcome

You can use this structure to create a new event for each desired interaction.  View an example of this construction in vrObjectInteractionPointAndClick.a3p

Extending Functionality

This is the very basic outline and example of how to set up a point and click event for VR.  To learn more about how to structure and extend this functionality we recommend viewing the lessons on events and conditional programming.  Using if/else blocks you can nest several different outcomes for different objects and program states into one event.