Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

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.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. 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. And always feel free to hit us up on Twitter @MxdRealityDev.

How to move a hologram with gaze

I am attempting to move a hologram with gaze, an example would be this:

Tap a hologram
Move your head - the hologram follows you
Tap again and it will place the hologram in place.

I essentially want to imitate the action when placing a Hololens app, etc.

I have been trying to do this based off the camera rotation but then I have no idea how far out to move it, etc.

I was wondering if there was an easy way to do this that I am missing?

Best Answer

Answers

  • sptspt ✭✭

    This is covered in the academy example 101E in
    part 6.

  • @JoshWeaver if you are looking to create a clean new app from scratch with your own 3D model then using the HoloToolkit is the way to go.

    I gave an hour long talk at our local user group meeting a couple months back where I ran through the steps in front of a live audience doing exactly this plus a few other extras like a couple of voice commands to size the object.

    The basic steps that you want to talk are outlined in another post that I made here.

    Please let me know if you have any questions. I am thinking of doing a few YouTube tutorials when I find the time and I would be interested in hearing any parts that are tripping people up.

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • @HoloSheep I followed your instructions, however nothing is happening when I try and select the object.

  • @JoshWeaver can you share a screenshot of the Hierarchy and editor in Unity that shows the box collider.

    And is the cursor changing from a dot to a ring when you gaze on and off your object (before you select it)?

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • edited July 2016

    If you need more than this, let me know.

    And yes, it does.

    Edit: I just noticed I had the TapToPlace script on the wrong level (Cube, instead of Weather). I fixed it, and I am still having the same issue.

    The issue is that OnSelect() Is not being called for the object I want to move and I am unsure as to why.

    I am also using the most recent version of HoloToolKit if that makes any difference.

  • edited July 2016

    @HoloSheep That worked, thank you for all your help!

    A slightly different question, is are there resources on tapping/holding and dragging a hologram off scene?

  • @JoshWeaver just curious, which of the last two suggestions solved your issue or was it a combination of the both?

    When you say you are looking to drag a hologram off scene I gather that instead of placing it on surfaces you would rather place it a certain distance away from you (say 2 meters) regardless of the surfaces detected in the room?

    Or are you saying that you basically want to remove/delete the object from the scene when you drag it in a certain way?

    If you look in the TapToPlace script the Update routine is what controls where the object is repositioned as you gaze around and the placing flag gets turned off the object stays at the position it was last at.

    The TapToPlace routine is using a Raycast that returns a collision with the Spatial Mapping mesh. If you rather have the Update place it a specific distance away you could simply change the line:

    this.transform.position = hitInfo.point;

    to logic that sets the position to 2 meters in the direction you are looking:

    this.transform.position = headPosition + gazeDirection * 2f;

    of course you should also go in and clean up the unnecessary ray cast if this where going to be a long term change, but that one line change might allow you to experiment to see if that is the kind of thing that you want.

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

Sign In or Register to comment.