AR Camera GYRO — Unity Asset that uses camera and gyroscope on the player’s mobile device to display 2D or 3D objects as though they were in the real world.
Cross-platform mobile gyroscopic camera implements markerless augmented reality (AR) by using a gyroscope sensor (like Pokemon GO).
- 1. AR Camera GYRO and ARKit, ARCore
- 2. Package is a part of Unity Assets
- 3. Package Contains
- 4. Gyro vs. Accelerometer
- 5. Tested with Devices
- 6. Tutorial
- 7. Known issues
- 8. Advantages
- 9. Support
- 10. Changelog
AR Camera GYRO and ARKit, ARCore
There is no integration with ARKit & ARCore.
Unity AR Camera GYRO operates with gyroscope without surface detection to cover a wider range of mobile devices than ARKit & ARCore.
Read more about Top AR Engines for Unity.
Package is a part of Unity Assets
All modules are designed independently to keep this asset extendable & easy to understand:
- Demo with AR Shadow.
Gyro vs. Accelerometer
90% of all mobile devices have an accelerometer and video camera but only 20% have a gyroscope.
You can also try to use both cameras for different cases.
Different devices have different gyroscopes, and therefore different deviations and drifts.
Tested with Devices
- iOS on iPhone 6.
- Android on Samsung Galaxy S7, Lenovo A606.
- UWP on Microsoft Surface Pro 5, Acer Switch 5.
How to transform your scene into Augmented Reality with AR Camera GYRO?
I used Unity 2017.3.1f & iOS 11.2 for this tutorial.
But you can also build it for Android.
- Create New Unity Project.
- Import AR Camera GYRO.
- Import Your Scene.
- Switch to a Target Platform.
- Open Your Scene.
- Prepare Your Scene.
- Create Game Object called “GameWorld” to conveniently move the environment of your scene.
- Move all environment into “GameWorld” Game Object.
- Delete the Main Camera.
- Drag new instances of prefabs into “GameWorld” Game Object: “ARDirectionalLight” & “ARGround”.
- Delete your “ground”, position and scale “ARGround” for AR Shadows.
- Delete your main Directional Light.
- Drag a new instance of prefab into the scene: “ARCameraGYRO”.
- Position & Rotate “GameWorld” Game Object so that the environment could be seen in the Game View.
- Customize Quality Settings.
- Edit > Project Settings > Quality > Default Quality > High.
- Pixel Light Count = 1.
- Realtime Reflection Probes = false.
- Billboards Face Camera Position = false.
- Shadow Resolution = Very High Resolution.
- Shadow Projection = Close Fit.
- Shadow Distance = 400.
- Customize Player Settings.
- Bundle Identifier = your.own.name.
- Camera, Location & Microphone descriptions > Any.
- Target minimum iOS Version > convenient for your phone.
- Build And Run.
- If you faced the problem in Xcode then indicate your Team for successfully deploying.
ARCameraGYRO prefab & GyroCameraControl.cs
ARCameraGYRO prefab has main camera control script: GyroCameraControl.cs.
Camera for virtual world rotating depending on the gyro data.
You can assign a function (in the inspector) to be executed if the gyroscope is not supported by your smartphone.
Interface into the Unity Gyroscope. Use this variable to access gyroscope.
Is a gyroscope available on the device?
rotationFix = new Quaternion (0f, 0f, 1f, 0f);
Unity AR bugs: Gyroscope
- INPUT.GYRO.ATTITUDE returns zero values on Motorola Moto G4 and G5.
- Fixed in Unity 2018.2: INPUT.GYRO is extremely laggy on Samsung Galaxy S6, S6 Edge and S8 with Android 7.0.
- Fixed in Unity 2017.2: INPUT.GYRO.ATTITUDE returns acceleration’s values.
Vote on these issues and comment them.
It’s important for Unity Team, so users should pay them attention to the situation.
Black screen on iOS
You just need to fill Camera Usage Description in Unity Editor.
Go to Unity Editor > Player Settings > iOS > Other Settings > Camera Usage Description > Fill it (any note for your app).
Bring the enchanting Power of Augmented Reality into your amazing Game or App:
- 4 minutes installation for Your Scene.
- Greater coverage of devices than ARKit, ARCore, Vuforia, etc.
- Same AR as in Pokemon GO game.
Check the current version on Asset Store.
The latest versions will be added as soon as possible.