<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Infinity Code Forum — Mixed Reality Toolkit?]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=1729</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1729&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Mixed Reality Toolkit?.]]></description>
		<lastBuildDate>Tue, 30 Mar 2021 17:05:25 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Mixed Reality Toolkit?]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=7333#p7333</link>
			<description><![CDATA[<p>I finally worked out a solution that is giving me what I was looking for, hopefully this helps someone down the road.</p><p>Attach this to an empty gameobject</p><div class="codebox"><pre><code>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 = &quot;Marker: &quot; + (OnlineMapsMarkerManager.CountItems + 1);
    // Create a new marker.
    OnlineMapsMarkerManager.CreateItem(lng, lat, label);
 }
}</code></pre></div><p>And then we just need a custom method that will use the Vector3 we got from the gaze instead of the mouse</p><div class="codebox"><pre><code> public bool GetCoords_MRTK(Vector2 gazePosition, out double lng, out double lat)
 {
    return GetCoords(gazePosition, out lng, out lat);
 }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (mcb)]]></author>
			<pubDate>Tue, 30 Mar 2021 17:05:25 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=7333#p7333</guid>
		</item>
		<item>
			<title><![CDATA[Re: Mixed Reality Toolkit?]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=7287#p7287</link>
			<description><![CDATA[<p>True it doesn&#039;t have GPS, but I can get it to render in the headset just fine, its interacting with the terrain that is proving illusive.</p><p>In the editor I can add markers, but running the app, not so much.</p><p>Anyways, I figured it was worth a shot asking</p>]]></description>
			<author><![CDATA[null@example.com (mcb)]]></author>
			<pubDate>Mon, 22 Mar 2021 18:03:11 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=7287#p7287</guid>
		</item>
		<item>
			<title><![CDATA[Re: Mixed Reality Toolkit?]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=7286#p7286</link>
			<description><![CDATA[<p>Hello.</p><p>Unfortunately, I am not developing for AR / VR, and I just do not have these devices to explore it.<br />As far as I know, Hololens simply doesn&#039;t have a GPS to make it work.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Mon, 22 Mar 2021 17:55:10 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=7286#p7286</guid>
		</item>
		<item>
			<title><![CDATA[Mixed Reality Toolkit?]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=7283#p7283</link>
			<description><![CDATA[<p>Hey devs, curious if you have had a chance to explore implementation with the Hololens MRTK yet? I&#039;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.</p><p>Any guidance or advice you may have to offer would be appreciated as most of what I try to do has no effect yet.</p><p>Currently, I&#039;m trying to get it to where when I click on the terrain with the &quot;pointer&quot; 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.</p><p>Thanks in advance for any assistance</p>]]></description>
			<author><![CDATA[null@example.com (mcb)]]></author>
			<pubDate>Mon, 22 Mar 2021 16:03:04 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=7283#p7283</guid>
		</item>
	</channel>
</rss>
