Select to view content in your preferred language

Geometry API / drawing

515
2
12-08-2022 02:45 PM
Unity_gis
Occasional Contributor

I see there is a lot of Geometry API

https://developers.arcgis.com/unity/api-reference/gameengine/geometry/arcgislinesegment

 

I couldn't find any examples using this. Does this API have drawing mechanisms to it or is is just the raw data and we figure out the tooling and rendering ourselves?

I saw one of the example projects description said it uses the unity line renderer classes to draw a line. Is this the route we should be taking or is there a deeper rendering/line/polygon drawing built in to the arcgisdk?

 

 

0 Kudos
2 Replies
Matt_Nelson
Esri Alum

This of our Geometry APIs like a Math library in a programming language.
It has lots of built in functions and classes to help you calculate positions, convert between spatial references and stuff like that but if you want to see the result you will need to interface it with other unity GO's like the location component.

0 Kudos
Unity_gis
Occasional Contributor

So is there a drawing/rendering with this or it it just strictly data management? In the Esri samples they use unity's line renderer and also a scaled cylinder to represent lines (not any kind of esri drawing api). So I'm thinking I have to do my own line rendering. Still not fully sure. see example to please clarify:

 

 

 

public class GeomTest : MonoBehaviour
{
    public ArcGISLocationComponent item1; // gameobject assigned in inspector
    public ArcGISLocationComponent item2;

    void Start()
    {
         ArcGISPoint p1 = item1.GetComponent<ArcGISLocationComponent>().Position;
         ArcGISPoint p2 = item2.GetComponent<ArcGISLocationComponent>().Position;

         ArcGISLineSegment line = new ArcGISLineSegment(p1,p2);
         print(line.StartPoint.X); 
    }
}

 

 

 

So I have this line segment created but im not sure what im supposed to do with it. The game objects all have ArcGISLocationComponents on them and are visible in the game. the reading (print/debug data)of the line data all looks correct numbers.

but how do I show this line? do I create my own line rendering on my end using unity line renderer/plugins and use the Esri ArcGISLineSegment strictly as a data container?

 

0 Kudos