Select to view content in your preferred language

Unity, MoveGeodetic and ArcGISMutableArray?

444
2
10-02-2023 12:22 PM
PacoEnGlobant
New Contributor

I'm trying to do some offset of a point but I want to do it in meters, I found out there is the Geometry Engine for that but I noticed in the Unity SDK it's weird how it's supposed to be called. From what I've seen in any other SDK the input is a simple array but here it's a Mutable Array and I cannot find any way to populate it

It kinda looks that ArcGISMutableArray it's missing a Builder (just like the one present in the Immutable version

static ArcGISImmutableArray<ArcGISPoint> MoveGeodetic(ArcGISMutableArray<ArcGISPoint> pointCollection, double distance, ArcGISLinearUnit distanceUnit, double azimuth, ArcGISAngularUnit azimuthUnit, ArcGISGeodeticCurveType curveType)

https://developers.arcgis.com/unity/api-reference/gameengine/geometry/arcgisgeometryengine/#movegeod...

 

more context:

I have one of the ArcGISExtent, with a center point and shape dimension defined in meters. I want to get the Location Coordinate of the corners. It's not just adding the meters offset coz those are different measurments. ¿Maybe there is an alternative for moving a point in meters of getting a coordinate with a meters offset or something?

 

Thanks

0 Kudos
2 Replies
TobyAmbrose
New Contributor

Hello, I am struggling to construct an ArcGISMutableArray as well.  Searched through the sample projects but no luck.

Did you find a solution?

Thank you

0 Kudos
MBambino_ATS
New Contributor III

I figured out an alternative to MoveGeodetic, though it is likely less robust.

If you convert the point to game space first, add your offset, then convert back into an ArcGISPoint, it should achieve the desired effect since Unity uses meters as it's base unit. 

public ArcGISPoint MovePointByMeters(ArcGISMapComponent map, ArcGISPoint point, Vector3 move){
    var unityPoint = map.GeographicToEngine(point);
    unityPoint += move;
    
    return map.EngineToGeographic(unityPoint);
}

 

0 Kudos