Topic: Mixed Reality Toolkit?

Hey devs, curious if you have had a chance to explore implementation with the Hololens MRTK yet? I'm trying to port over some work I have done in webGL and android development with OnlineMaps as my boss now wants to see it in the headset.

Any guidance or advice you may have to offer would be appreciated as most of what I try to do has no effect yet.

Currently, I'm trying to get it to where when I click on the terrain with the "pointer" that I return the GPS coordinates and the basic implementation from the atlas of examples isnt working, I assume because there is probably some piece connecting inputs that online maps is expecting and what MRTK is using.

Thanks in advance for any assistance

Re: Mixed Reality Toolkit?

Hello.

Unfortunately, I am not developing for AR / VR, and I just do not have these devices to explore it.
As far as I know, Hololens simply doesn't have a GPS to make it work.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Mixed Reality Toolkit?

True it doesn't have GPS, but I can get it to render in the headset just fine, its interacting with the terrain that is proving illusive.

In the editor I can add markers, but running the app, not so much.

Anyways, I figured it was worth a shot asking

Re: Mixed Reality Toolkit?

I finally worked out a solution that is giving me what I was looking for, hopefully this helps someone down the road.

Attach this to an empty gameobject

using Microsoft.MixedReality.Toolkit;
using Microsoft.MixedReality.Toolkit.Utilities;
using UnityEngine;

public class GetCoordHandler : MonoBehaviour
{
    private Vector3 gazePoint;

    private void Update()
    {
        // key z in editor, A button on xbox controller
        if (Input.GetKeyDown(KeyCode.Z) || Input.GetKeyDown(KeyCode.Joystick1Button0))
        {
            // make sure we have hit something
            if (CoreServices.InputSystem.GazeProvider.GazeTarget)
            {
                // grab where the gaze pointer is
                gazePoint = CoreServices.InputSystem.GazeProvider.HitInfo.point;
                // convert this position to screen coords and fire the method
                AddMarker(CameraCache.Main.WorldToScreenPoint(gazePoint));
        }
    }
}

private void AddMarker(Vector3 point)
{
    // Get the coordinates under the cursor.
    double lng, lat;
    // custom method that returns the coordinates
    OnlineMapsControlBase.instance.GetCoords_MRTK(point, out lng, out lat);

    // Create a label for the marker.
    string label = "Marker: " + (OnlineMapsMarkerManager.CountItems + 1);
    // Create a new marker.
    OnlineMapsMarkerManager.CreateItem(lng, lat, label);
 }
}

And then we just need a custom method that will use the Vector3 we got from the gaze instead of the mouse

 public bool GetCoords_MRTK(Vector2 gazePosition, out double lng, out double lat)
 {
    return GetCoords(gazePosition, out lng, out lat);
 }