Select to view content in your preferred language

trouble's teleporting player to ArcGIS location

462
1
10-06-2022 07:07 AM
HacksHaven
Emerging Contributor

Hello, I have a situation where I'm trying to set the position of a player's ArcGISLocationComponent to that of another ArcGISLocationComponent of a known place mark. It seems to work most of the time but on occasion randomly teleports the player far beyond the edge of the map.  Has anyone experienced this before and more importantly know how to fix it?

Here is some sample code:

ArcGISPoint tourGeographicCoordinates = new ArcGISPoint(tourStop.GetComponent<ArcGISLocationComponent>().Position.X, tourStop.GetComponent<ArcGISLocationComponent>().Position.Y - 500f, 350, ArcGISSpatialReference.WebMercator());

playerLocationComponent.Position = tourGeographicCoordinates;
playerLocationComponent.Rotation = new ArcGISRotation(0, 90, 0);
0 Kudos
1 Reply
Matt_Nelson
Esri Alum

You shouldn't hardcode this to webmercator 

ArcGISSpatialReference.WebMercator()


Not sure that is the problem but to be safe what you should be doing is  

tourStop.GetComponent<ArcGISLocationComponent>().Position.SpatialReference
0 Kudos