Select to view content in your preferred language

Teleport Area in Unity for the Quest 2

1714
16
Jump to solution
09-06-2022 12:29 AM
WH1981
by
New Contributor III

Hello,

I have a question. I can turn my head in the Oculus Quest 2 and i can look around the city. I can also Continous move over the Basemap with the dumpstick of the controller but now i trying to make a teleport area on the basemap or the roads layer so that i can jump to locations ((continous move is slow:)). I have set a teleport provider on the XR Origin and often you can add the teleport area component at a gameobject that has a collider with the result you can jump on it. But the Basemap and Road layer are game objects?

Can someone help me with this?

 

 

 

 

 

WH1981_0-1662448907156.png

WH1981_1-1662449155055.png

 

0 Kudos
2 Solutions

Accepted Solutions
IngmarWittmann
New Contributor II

There is a Script called "SceneComponentProvider" in the ArcGisMapsSDK for Unity Package.

IngmarWittmann_0-1666158455097.png

(would be nice to attach the script directly here, but i didnt get it to work)

Script for attaching(super dirty:-)):

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;

public class findobject : MonoBehaviour
{
GameObject[] myobject;
int arraylength;
void Update()
{
myobject = GameObject.FindGameObjectsWithTag("ArcGis");

if (myobject.Length != arraylength)
{
for (int i = 0; i < myobject.Length; i++)
{
if (myobject[i].GetComponent<TeleportationArea>() == null) { myobject[i].AddComponent<TeleportationArea>(); }
}
}

arraylength = myobject.Length;
}
}

 

View solution in original post

0 Kudos
IngmarWittmann
New Contributor II
0 Kudos
16 Replies
coryeicher
Occasional Contributor

One approach that works is to create some non-Esri game objects in your scene and set those up as teleport areas. This is the approach I have taken. 

I have not tried to create teleport areas directly on Esri objects. Perhaps others in the community will share their attempts/experiences with this.

-Cory

CORY EICHER
www.eichcorp.com
cory@eichcorp.com
0 Kudos
WH1981
by
New Contributor III

He, Thanks for your answer. My solution was also to increase the Continous movement distance in seconds. I can walk faster now.

I hope ESRI find a way to give the possibility to put teleport areas on raster of vector layers.

0 Kudos
Matt_Nelson
Esri Contributor

There is not out of the box way to do that yet. You can mock a teleportation by casting a ray from the controller and getting the point it hits the basemap. (same as what we are doing in the ArcGIS Raycast sample) but instead move the camera to that point

0 Kudos
IngmarWittmann
New Contributor II

Had the same issue, i tagged all the ArcgisGameObjects, search for the tagged objects in update and attached the Telepot Area Script to each one. 

0 Kudos
WH1981
by
New Contributor III

Hello,

What do you mean with Tagged? The layer tiles load everytime again when you look to it in the headset. And then it also gets another game object number and lost the Teleport Area script.

0 Kudos
IngmarWittmann
New Contributor II

There is a Script called "SceneComponentProvider" in the ArcGisMapsSDK for Unity Package.

IngmarWittmann_0-1666158455097.png

(would be nice to attach the script directly here, but i didnt get it to work)

Script for attaching(super dirty:-)):

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;

public class findobject : MonoBehaviour
{
GameObject[] myobject;
int arraylength;
void Update()
{
myobject = GameObject.FindGameObjectsWithTag("ArcGis");

if (myobject.Length != arraylength)
{
for (int i = 0; i < myobject.Length; i++)
{
if (myobject[i].GetComponent<TeleportationArea>() == null) { myobject[i].AddComponent<TeleportationArea>(); }
}
}

arraylength = myobject.Length;
}
}

 

0 Kudos
WH1981
by
New Contributor III

Where (on which gameobject?)do i place the scène component provider script to tag all gameobjects with ArcGiS. And where the attaching script to attach the teleport component to the ArcGIS tagged gameobjects? 

0 Kudos
m_d
by
New Contributor II

Thanks for the solution and code. It works, though agreed--is pretty dirty. Still.

With the new v1.1.0 SDK, the file to modify seems to now be Esri.ArcGISMapsSDK.Renderer.Renderables.RenderableProvider.

0 Kudos
IngmarWittmann
New Contributor II

You just need to insert the line of code(red Arrow in the Picture above) in the SceneComponentProvider Script this will tag all ArcGis Gameobjects with the Tag"ArcGis". Then you need to add this Tag in the Unity Editor.

IngmarWittmann_0-1666617262087.png

the "findobject" Script from above  just put it on an empty gameobject in the scene.

 

0 Kudos