Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

How can I determine if an object I tap on is a particular game object?

I am trying to change scenes on tapping a particular object, but I don't want to change scenes unless I tap in a particular area. How can I determine the object I tapped is the object that needs to be tapped on to change scenes?

Answers

  • Options

    The best place to look for an example would be in Holograms 101 in the Gestures chapter.

    Cliff's notes:
    1. The GameObject must have a collider
    2. You cast a ray (Physics.Raycast) from the user's head position (Camera.main.transform.position) in the direction of the user's head (Camera.main.transform.forward).
    3. The RaycastHit parameter (often named HitInfo) has the object that the user is looking at in HitInfo.collider.gameObject.

    The Origami project has a script that casts the ray each frame (GazeGestureManager) that other classes (such as the cursor class) can access where the user is looking and what the user is looking at. The GazeGestureManager also handles air taps and calls SendMessage("OnSelect"); on the gameObject in focus. If that GameObject has a script with an OnSelect function then that function will be called.

    In your case you could have the scene switching object initiate switching scenes in an OnSelect function.

    ===
    This post provided as-is with no warranties and confers no rights. Using information provided is done at own risk.

    (Daddy, what does 'now formatting drive C:' mean?)

Sign In or Register to comment.