Code Monkey home page Code Monkey logo

unity-plugin's Introduction

IndoorAtlas Unity Plugin

IndoorAtlas provides a unique Platform-as-a-Service (PaaS) solution that runs a disruptive geomagnetic positioning in its full-stack hybrid technology for accurately pinpointing a location inside a building. The IndoorAtlas SDK enables app developers to use high-accuracy indoor positioning in venues that have been fingerprinted.

Getting started requires you to set up a free developer account and fingerprint your indoor venue using the IndoorAtlas MapCreator 2.

Getting Started

  • Set up your free developer account in the IndoorAtlas developer portal. Help with getting started is available in the Quick Start Guide.
  • To enable IndoorAtlas indoor positioning in a venue, the venue needs to be fingerprinted with the IndoorAtlas MapCreator 2 tool.
  • To start developing your own app, create an API key.
  • An example Unity project is included in the example folder.

It's recommended you use Unity version 2021.3.17f1 or higher.

How to Use

  • IndoorAtlas API key and secret. You can generate credentials from our website.

Example

There's an example Unity project which implements basic AR wayfinding functionality using the IndoorAtlas AR Wayfinding component. To build and run it on a real device, you may have to change the bundle identifier field in the Player Settings and fill your IndoorAtlas credentials to IndoorAtlas Session component. You'll need a location with POIs so you can choose a POI from the drop-down list to navigate to.

NOTE: For the AR functionality you will need a API key with AR support enabled. Please contact IndoorAtlas sales for this!

Screenshot of the example

Scripting

There is a IndoorAtlasApi.cs included that wraps most of our Android and iOS SDK functionality to C#. You may use this api in your own components. To get callbacks from the Android and iOS SDK, your component should be children of IndoorAtlas Session component, and implement onei or more of the following methods:

  • IndoorAtlasOnLocationChanged
  • IndoorAtlasOnStatusChanged
  • IndoorAtlasOnHeadingChanged
  • IndoorAtlasOnOrientationChanged
  • IndoorAtlasOnEnterRegion
  • IndoorAtlasOnExitRegion
  • IndoorAtlasOnRoute

To get better idea of how these callbacks work and what are their arguments, check the IndoorAtlasSession.cs source file.

Coodinate systems

This repository contains WGSConversion class (in IndoorAtlasWGSConversion.cs file) which can be used to convert IndoorAtlas SDK's (latitude, longitude) coordinates to metric (east, north) coordinates.

A numerical example

Set first a fixed point ("origin") to your 3D scene with SetOrigin method, for example:

IndoorAtlas.WGSConversion temp = new IndoorAtlas.WGSConversion ();
temp.SetOrigin (63.357219, 27.403592);

Relative (east, north) transitions can be computed with WGStoEN method after the origin has been set, for example:

Vector2 eastNorth = temp.WGStoEN (63.357860, 27.402245);
Debug.Log ("East-North transition: " + eastNorth.x + ", " + eastNorth.y);

This gives a transition of (-67.42091, 71.45055) from origin, that is, a transition of ~67 meters to west and ~71 meters to north from origin.

License

Copyright 2021 IndoorAtlas Ltd. The Unity Plugin is released under the Apache License. See the LICENSE file for details.

unity-plugin's People

Contributors

cloudef avatar gitjuba avatar simomar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unity-plugin's Issues

Cocoapods / Podfile not working on iOS Unity builds

Hi all :)

I get the following errors at the OnPostProcessBuild stage of building an iOS Xcode project with Unity, using the example Unity project with a few adaptions:

Failed running cocoapods. Make sure cocoapods is installed and you target to iOS 8.0 or newer.
UnityEngine.Debug:LogError(Object)
XcodeFixes:OnPostprocessBuild(BuildTarget, String) (at Assets/Plugins/iOS/Editor/XcodeFixes.cs:68)
UnityEditor.HostView:OnGUI()


Error building Player: Failed running cocoapods. Make sure cocoapods is installed and you target to iOS 8.0 or newer.


UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:162 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:83 
UnityEditor.HostView:OnGUI()

"Target minimum iOS version" in Unity player settings is "8.0"
"which pod" in Terminal yields "/usr/local/bin/pod"
"pod --version" in Terminal yields "1.3.1"
Podfile in Assets/Plugins/iOS/ contains:

target 'Unity-iPhone' do
  pod 'IndoorAtlas', '~> 2.5.1'
end

So:

  • Cocoapods is installed
  • iOS Target 8.0
  • It gets all the way down to line 68 in XcodeFixes.cs before returning the error.

What can I do about this?

Indoor Navigation System is not displayed.

Hello Sir,
We want to do indoor navigation of our location
So to do that we have taken location with its mapable area along with its positioning from mapCreator2 of Indoor Atlas.

After that we have taken Indooratlas AR Wayfinding in unity & also to this we have attached latitude and longitude coordinates of our location with required components.

But in Android device only camera is opening
Not any AR components to navigate.

Please guide me to this issue.

Converting Lat/Long to meters producing incorrect values

Hello,

I've been attempting to get appropriate output out of the "example/3d-position" branch, and in particular, WGSConversion.cs.

I am expecting to be able to feed in lat and long of a known position relative to the unity scene, which the origin of the unity scene, and have IndoorAtlas lat and long values converted into meter-scale deviation from that center point.

However, I am getting enormous values- orders of magnitude larger than what one would expect.

It's possible I am doing something incorrectly, but this could also be an issue with the code.

[Unity] IABehavious.cs Error on Play NullReferenceException

Hi,

I'm new to IA and Unity development.
I'm getting this error while I attach my IABehaviour.cs script to the GameObject of my choice. I'm using Mapbox along with IA to develop an app.

On attaching and playing, I'm getting the error code given below which I didn't understand. Kindly help me in understanding my mistakes.

Exception: JNI: Init'd AndroidJavaClass with null ptr!
UnityEngine.AndroidJavaClass..ctor (IntPtr jclass) (at C:/buildslave/unity/build/Runtime/Export/AndroidJavaImpl.cs:622)
UnityEngine.AndroidJavaObject.get_JavaLangClass () (at C:/buildslave/unity/build/Runtime/Export/AndroidJavaImpl.cs:600)
UnityEngine.AndroidJavaObject.FindClass (System.String name) (at C:/buildslave/unity/build/Runtime/Export/AndroidJavaImpl.cs:591)
UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) (at C:/buildslave/unity/build/Runtime/Export/AndroidJavaImpl.cs:611)
UnityEngine.AndroidJavaClass..ctor (System.String className) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/AndroidJavaBindings.gen.cs:92)
IaBehavior.Start () (at Assets/Plugins/IaBehavior.cs:25)

After I stop my app in Unity, it gives the below error code. So, which object am I supposed to set with the OnDestroy function?

NullReferenceException: Object reference not set to an instance of an object
IaBehavior.OnDestroy () (at Assets/Plugins/IaBehavior.cs:42)

[Android] IndoorAtlas blocks other WWW and HttpAPIService when activated.

HI, I'm an android user. IndoorAtlasForUnity works for me. But I have to stop using it. Cause I'm using other info services which using HttpAPICall or done by Unity's WWW (for example Playfab and Google Map API), And when IndoorAtlas is activated they are blocked!
I'm not a programmer and an English speaker, hope you could understand me.
I guess there are some conflicts or IndoorAtlas is hogging the service.
Hope there will be a fix soon.
Thanks.

unity example error

Assets/Plugins/IaBehavior.cs(8,19): error CS0234: The type or namespace name Android' does not exist in the namespace UnityEngine'. Are you missing an assembly reference?

Geofencing Not working

when trying to add geofences to the plugin using function placeGeoFence() - called at the end of init : the error [IARegion boundingBox]: unrecognized selector sent to instance 0x1c4659140 pops up
`- (void)placeGeofence
{

NSMutableArray<NSNumber*> *edges = [NSMutableArray array];

[edges addObject:[NSNumber numberWithDouble:-37.84811769]];
[edges addObject:[NSNumber numberWithDouble:145.11430576]];
[edges addObject:[NSNumber numberWithDouble:-37.84802129]];
[edges addObject:[NSNumber numberWithDouble:145.11431266]];
[edges addObject:[NSNumber numberWithDouble:-37.84792601]];
[edges addObject:[NSNumber numberWithDouble:145.11432588]];
[edges addObject:[NSNumber numberWithDouble:-37.84792520]];
[edges addObject:[NSNumber numberWithDouble:145.11433971]];
[edges addObject:[NSNumber numberWithDouble:-37.84802397]];
[edges addObject:[NSNumber numberWithDouble:145.11433594]];
[edges addObject:[NSNumber numberWithDouble:-37.84811399]];
[edges addObject:[NSNumber numberWithDouble:145.11432856]];

self.geofence = [IAPolygonGeofence polygonGeofenceWithIdentifier:@"Area 1" andFloor:nil edges:edges];

[self.manager startMonitoringForGeofence:self.geofence];

}
`
The error occurs on the last line startMonitoringForGeofence

onLocationChanged does not return value

I have followed the instructions to setup the floor plan and fingreprinted the venue, and assigned wayfiding points.

Then I copied plugins to my unity app and added Iabehaviour and Ialistener to the main camera.
image
I was hoping to receive the lat long in a text, but nothing is returned. Status is available and TraceID is returned.
Surprisingly I don't even get my location in Map Creator2 Test postioning. :(

[Unity]WGSConversion difference

Hello,

In Unity we have a map scaled to follow the 1 in unity = 1m. When testing we notice a big difference in position between the Test Positioning app (from Map Creator 2) and our Unity app.
We compared the Long/Lat received by the 2 apps and they're the same. So we suspect something is wrong with our use of the WGSConversion class.

Our scene is a map with a cube to show the user position.

  • We set up the origin to the "middle" of the map in unity (we used the Test Positioning app to have the GPS coordinates of this middle). To simplify calculations this middle AND the cube are put at the (0,0) position

  • Then every time we receive a new Long/Lat we use WGStoEN method to get the position relative to the origin

  • Then we just translate the cube with the calculated values (since 1=1m)

Our problem is the following: The cube is following the phone movement BUT the position of the cube on the map is not as good as the Test positioning (even after 2 or 3 meters). I'd like to know if there's something we missed (we already checked #4 but I don't think they had the same problem).

Wayfinding

I would like to know if there is any way we can have a cs file which gives us a list of points(latitude and longitude) to reach the destination.

Is there any file same as WayFinding in android and ios SDK examples?

It would be a great help.

Thanks.

[Android][IOS]WWW requests blocked

Hi,

When using Indoor Atlas, it's impossible to communicate with a database since the WWW are not working. The call isn't made at all... Unity logs show no error.

Unity version 2017.3.0p2

Any workaround/fixes for that?

Thanks!

Raw pos is off in-app comparing to MapCreator2

Hey guys. Loving your service! :)

I have an issue which I've tested and tried to fix for weeks. Location in MapCreator2 by testing the positioning is almost flawless. It's precise to about 0.5m which is really awesome.

Using the IndoorAtlas Asset for Unity however does come up with offset and possible scaled raw location data in my experience. Usually I see an offset of about 8m too far West of where I actually am, and offset seems to increase when I move farther away from the originPos set in WGSConversion in the script which is the 0,0,0 in Unity. Here are some debugs:

Trace ID using MapCreator2: 80641580-67e3-11e8-ac15-425cdd18abf5.1528108743888.701
I will report the TraceID as well.
Download of Trace JSON: 80641580-67e3-11e8-ac15-425cdd18abf5.1528108743888.701.events.zip

Here's a screenshot of MapCreator where I stand next to the corner (real position is orange and MapCreator2 handles this fine)
screenshot_20180604-120725

Here's a screenshot of that same area in the app (again my real position is in orange):
screenshot_20180604-124533

  • Pink is where IA believes we are (that's the MapNav Converter Pos)
  • Light Blue cross in the center of the screenshot is where the Unity 0,0,0 and OriginPos is set. This corresponds to the "fixLat" and "fixLon" in the green debug console.
  • Don't mind the other markers for now
  • The green debug console shows the "IA GPS" which is the raw output of the IA Asset. The raw location output is found using this:
void onLocationChanged(string data) {
		location = JsonUtility.FromJson<IndoorAtlas.Location>(data);
        ialatitude = location.latitude;
        ialongitude = location.longitude;
        AWE_Debugger.Instance.AddDebug("IA GPS: (" + ialatitude + ", " + ialongitude + ")");

Taking these debug outputs into a GPS plotter online shows this (press "Draw the map")
https://goo.gl/GxPi2c

So overall, comparing the position in MapCreator visually with the one in my app doesn't match up - although in the GPS plotter you can see that the IA MapCreator GPS is very close to the IA in-app GPS point
Also, MapCreator2 comparing to the visual map on the GPS plotter shows that it seems off as well.

I guess my question comes down to this:
Why is there a difference in the IA positioning in MapCreator2 visually with what I'm seeing in the app and on online GPS plotters?
Why is the positioning in MapCreator2 spot on, while there's an offset in my own app and on GPS plotters?

Add Path With Augmented reality, Need Z- coordinate

Hello Team

I am trying to create indoor navigation path with Augmented reality, I have used your example to start my work, In your example i have seen, you are getting "X" and "Y" position, By using current latitude and longitude, But In case of Unity i need to render 3D object like arrow or simple line to show the paths or We can say road navigation, For this i need "Z" co-ordinate also. But your WGSConversion class i am getting only "deltaX" and "deltaY" values, How i can get "Z" axis value, I have refereed your below code.

        const double a = 6378137.0;            // Earth's semimajor axis in meters in WGS84
   	const double f = 1.0 / 298.257223563;  // Earth's flattening in WGS84
   	const double b = a * (1.0 - f);
   	const double a2 = a * a;
   	const double b2 = b * b;
   	double sinlat = System.Math.Sin(System.Math.PI / 180.0 * latitude);
   	double coslat = System.Math.Cos(System.Math.PI / 180.0 * latitude);
   	double tmp = System.Math.Sqrt(a2 * coslat * coslat + b2 * sinlat * sinlat);

   	deltaX = (System.Math.PI / 180.0) * (a2 / tmp) * coslat;
   	deltaY = (System.Math.PI / 180.0) * (a2 * b2 / (tmp * tmp * tmp)); 

I am trying to create Indoor navigation like below link
Sample Example Video

Could you please help me to fix this issues? or If i am on any wrong path, Please help me to get proper way to make such app with indoorAtlass.

Your hardware does not support this application.

I tried to run this project ( examplescene ) in my mobile (Samsung Note8) with everything (wifi, Bluetooth, GPS, Location service) enabled but still it is giving us problem "You hardware does not support this application.". I followed the step of copying plugins folder to assets folder and also provided api key and api secret key to the file IaBehaviour.cs still problem persists.

Can you please guide us where is the problem?

Example doesn't work! Can not callback any data!

onLocationChanged,onStatusChanged,onHeadingChanged,onOrientationChange,onEnterRegion,onExitRegion these functions can not be callback, this example doesn't work! Could you please tell me how to calling component's callbacks immediatelly when start the app?i followed the instruction but it doesn't work!

How to use this plugin with Mapbox in unity?

Hi,

I'm new to Unity development and don't know how to use this plugin in Unity.
This is not a package that usually most SDKs are provided in. How can I import my indoor atlas positioning to use with Mapbox Unity?

Any basic tutorial will be very helpful.

Build Failed: Multiple dex files

Using Unity 2017.4.2f2, building the example scene using NDK r17, I get the following error when I try to build:

CommandInvokationFailure: Gradle build failed. 
C:\Program Files\Java\jdk1.8.0_161\bin\java.exe -classpath "C:\Program Files\Unity2017.42f2\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lbitter/jnibridge/JNIBridge$a;

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED in 19s
]
stdout[
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
The setTestClassesDir(File) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the setTestClassesDirs(FileCollection) method instead.
The getTestClassesDir() method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the getTestClassesDirs() method instead.
The ConfigurableReport.setDestination(Object) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the method ConfigurableReport.setDestination(File) instead.
:preBuild UP-TO-DATE
:preReleaseBuild UP-TO-DATE
:checkReleaseManifest
:preDebugBuild UP-TO-DATE
:prepareAndroidwrapperLibrary
:prepareIndooratlasAndroidSdk261Library
:prepareReleaseDependencies
:compileReleaseAidl
:compileReleaseRenderscript
:generateReleaseBuildConfig
:generateReleaseResValues
:generateReleaseResources
:mergeReleaseResources
:processReleaseManifest
:processReleaseResources
:generateReleaseSources
:incrementalReleaseJavaCompilationSafeguard
:javaPreCompileRelease
:compileReleaseJavaWithJavac
:compileReleaseNdk NO-SOURCE
:compileReleaseSources
:lintVitalRelease
:mergeReleaseShaders
:compileReleaseShaders
:generateReleaseAssets
:mergeReleaseAssets
:transformClassesWithDexForRelease FAILED
19 actionable tasks: 19 executed
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1 progress, System.String error)
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action`1 progress)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action`1 progress)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

Hardware not supported, despite building app to Nexus 6P

Hi guys.

I get this error below when trying to build the example scene from the supplied unity example project to Android. I have added API key and secret to the IaBehavior.cs.

Removing indooratlas-android-sdk-2.5.2.aar from the Unity project stops this message from happening! So the issues lie somewhere in the indooratlas-android-sdk-2.5.2.aar package.

In build settings, I've tried setting Install Location to both External, Automatic and Force Internal. I have also tried changing "preferExternal" in supplied AndroidManifest in Plugins folder to "InternalOnly" and "Auto" - without luck either.

My phone is a Nexus 6P rooted, which I've previously used to map rooms in Map Creator 2.

screenshot_20170925-135114

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.