1. Home
  2. Docs
  3. GO Map – Documentation
  4. Documentation
  5. Location Manager

Location Manager

LocationManager.cs

Using the unity Input.Location class LocationManager handles the gps positioning of the user’s device, converting the GPS coordinates in unity world coordinates (2D x,z). It uses events and delegation to notify the map that the users has moved and refresh the map tiles.

You can simulate GPS motion while playing inside the editor using W,A,S,D keys.

Parameters:

(bool) useLocationServices: toggles between using GPS positioning or fixed location. It is always false when playing inside editor.

(int) zoomLevel: *described above

(enum) demoLocation: a list of Location presets to use when playing inside editor or without locationServices. If it’s set to “custom” then the demo_Center World Coordinates is used (lat, lon, alt).

(int) desiredAccuracy: the value in meters to accept the location input data.

(float) updateDistance: the value in meters to consider location changes.

(enum) simulateMotion: the speed of the simulated motion when running inside editor.

(enum)motionMode: switch between GPS motion and avatar based motion. (best described in the GPS/Avatar motion chapter)

Banner:

The Location Manager object has a canvas in its hierarchy that is just an animated top bar showing the location status.

(bool) useBannerInsideEditor: animates the canvas while playing inside the editor.

(Panel) banner: the banner object. (disables animation if set to null)

(Text) Banner text: the text object. (disables animation if set to null)

Events:

A series of events are available with locationManager if you want to use it inside your classes.

  • OnOriginSet: Tells the exact moment when an origin is acquired. This means the first available gps location when running on a mobile phone and the set of a preset location when running in the editor. This event is very important as it tells exactly when you can begin converting coordinates. Conversions made before this event return infinity value.
  • OnLocationChange: This is fired every time a new location is acquired.
  • OnMotionStateChanged: You can use this event to trigger an animation on your character between the states of: Idle, Walk, Run. This event is fired every time the speed of your character changes significantly among the 3 states.
Was this article helpful to you? Yes 1 No 2

How can we help?