Unity Assets

AR Camera GYRO

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 real world.

Cross-platform mobile gyroscopic camera implements markerless augmented reality (AR) by using a gyroscope sensor (like Pokemon GO).

Unity Asset Store | Download Button

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.

Features of AR Camera GYRO

Bring the enchanting Power of Augmented Reality into your amazing Game or App:

  • 2 modes with Auto Rotation: Portrait, Landscape.
  • 3-minute installation for your own AR Scene.
  • Same AR as in Pokemon GO game.
  • Covering a wide range of mobile devices.
  • No using of other AR Engines like ARCore, ARKit, Vuforia, etc.
  • Real-Time AR Shadows (docs).
  • Quick Testing in Unity Editor without Smartphone.

Package is a part of Unity Assets

  1. VR + AR: Mixed Reality (MR) (docs).
  2. AR Toss Boss (docs).
  3. AR Basketball GO (docs).
  4. AR Survival Shooter (docs).
  5. AR Throwing (docs).

Package Contains

All modules are designed independently to keep this asset extendable & easy to understand:

Gyro vs. Accelerometer

90% of all mobile devices have an accelerometer and video camera but only 20% have a gyroscope.

If you want greater coverage of devices, but less accuracy and stability, use AR Camera ACCELEROMETER (docs).
If you want greater accuracy and stability, use AR Camera GYRO (docs).

You can also try to use both cameras for different cases.

Limitations

Different devices have different gyroscopes, and therefore different deviations and drifts.
Drift is natural for the mobile gyroscope sensor.

Tutorial

This tutorial is relevant for 3.3+ version of Asset.
Tutorials for previous versions can be found in asset folder.

Getting Started with AR Camera GYRO

Folders & Files in the package by default:

  • Makaka Games.

Steps

If you have any issues with the first launch then just Reach Support with Invoice Number and Get Help.

If you read this tutorial from PDF, first check the latest docs online to get actual information.

  1. Create a New Unity Project with Unity 2019.3.0.
  2. File > Build Settings > Switch to a Target Platform.
  3. Download and import AR Camera GYRO into Unity.
  4. Next Packages are provided with Unity Package Manager, and they are already installed for this Asset by default. If packages are missing (Warning Window has not appeared) then install them again with Unity Package Manager:
    1. TextMesh Pro 2.0.1:
      1. Always Required: Window > TextMeshPro > Import TMP Essential Resources;
  5. Customize Project Settings.
    1. Quality Settings:
      1. Edit > Project Settings > Quality > Default Quality > High.
      2. Pixel Light Count = 1.
      3. Realtime Reflection Probes  = false.
      4. Billboards Face Camera Position = false.
      5. Shadow Resolution = Very High Resolution.
      6. Shadow Projection = Close Fit.
      7. Shadow Distance = 400.
    2. Player Settings:
      1. Bundle Identifier = your.own.name.
      2. Camera, Location & Microphone descriptions > “AR Mode”.
      3. iOS: Target minimum iOS Version > convenient for your phone.
  6. Open Scene: Makaka Games > AR > Camera GYRO > Scenes > Demo.
  7. Test in the Unity Editor with Unity Remote or Build for Mobile.

Useful Article: How to Test iOS App without Developer Account?

Video: How to transform your scene into Augmented Reality with AR Camera GYRO?

  1. Prepare Unity Project as shown in the “Getting Started” chapter.
  2. Import Your Scene with Related Assets.
  3. Open Your Scene.
  4. Prepare Your Scene.
    1. Create a Game Object called “GameWorld” to conveniently move the environment of your scene.
    2. Move all environments into “GameWorld” Game Object.
    3. Delete the Main Camera.
    4. Drag new instances of prefabs into “GameWorld” Game Object:
      1. “ARDirectionalLight” with Rotation = (50, 25, 0);
      2. “ARGround” with X, Z scale you need.
    5. Delete your “ground”, position and scale “ARGround” for AR Shadows.
    6. Delete your main Directional Light.
    7. Drag a new instance of prefab into the scene: “ARCameraGYRO”.
    8. Position & Rotate “GameWorld” Game Object so that the environment could be seen in the Game View.
  5. Build And Run.

Script Manual

AR Camera GYRO prefab & GyroCameraControl.cs

ARCameraGYRO prefab has main camera control script: GyroCameraControl.cs.

Public
Gyro Camera

Gyroscope Camera for virtual world rotating depending on the gyro data.

Optional Flag: Is Gyro Disabled On Destroy

If it’s ‘true’ then Gyro’s “Y” Rotation is reset on Scene Closing or Reloading. Useful if you need to Control the Start Rotation of Camera when Restart.

Optional Event: On Gyro Is Not Supported

Here you can easily assign your own functions in case that smartphone doesn’t have the gyroscope. By default, you will see screen message: “Your device does not support gyroscope”.

Private
Gyro

Interface into the Unity Gyroscope. Use this variable to access the gyroscope.

Gyro Supported

Is a gyroscope available on the device?

Rotation Fix

It corrects the gyroscope rotation every Update () call.

Testing

There are 2 ways of testing without building an app:

Testing without the Smartphone

It’s a convenient way to frequently testing the same positions and rotations of the camera: “GyroCamera” Game Object. The phone does not need to be connected to the computer.

AR Camera GYRO — Unity Asset — Testing without Smartphone

So you can save these data with custom Transform components on Game Objects as shown on the screenshot: as children of “TestViewWithoutGyro” Game Object.

These transform components are parameters for the function called SetPositionAndRotation (Transform transform) which is executed on game start when “OnGyroIsNotSupported” event is called (i.e. Unity Editor environment or Smartphone without Gyroscope).

Use Case

I used this testing method when developing AR Basketball GO (docs). I needed to periodically test Normal Ball (with touching of Ring) & Clear Ball (without touching of Ring). Since throw “Clear Ball” is a hard task, I saved 2 different camera Transform components to change them when needed:

  1. Right Above the Ring;
  2. A Few Meters from the Ring.

Testing Time was decreased well because I didn’t need to take the mobile phone every time in my hands after changes in the game logic & move the phone manually. Instead of it, I had predefined data.

Tested with Devices

Mobiles:

  • iOS on iPhone 6, 8, XS Max.
  • Android on Samsung Galaxy S7, S10.

Tablets:

  • UWP on Microsoft Surface Pro 5, Acer Switch 5.

Known issues

Unity AR bugs: Gyroscope

  1. Fixed in Unity 2018.2: INPUT.GYRO is extremely laggy on Samsung Galaxy S6, S6 Edge and S8 with Android 7.0.
  2. Fixed in Unity 2017.2: INPUT.GYRO.ATTITUDE returns acceleration’s values.
  3. Hardware Issue: INPUT.GYRO.ATTITUDE returns zero values on Motorola Moto G4 and G5.

Your actions

Vote on these issues and comment on them.
It’s important for Unity Team, so users should pay their 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).

Support

First of all, read the latest docs online.
If it didn’t help, get the support.

Changelog

Check the current version on Asset Store.
The latest versions will be added as soon as possible.

3.3:

  • New Way of Testing in Unity Editor (On Gyro is not supported) with custom positions and rotations of camera. The phone does not need to be connected to the computer.
  • Tutorial Texts => TextMesh Pro.
  • Unity 2019.3.0.

3.2:

  • Optional Flag: “Is Gyro Disabled On Destroy”.
  • Optional Unity Event “On Gyro Is Not Supported”.

3.1:

  • Unity 2019.1.

3.0:

  • Unity 2018.3;
  • AR Shadow 1.3 (docs);
  • Fix low FPS in Unity Editor;
  • 2 modes with Auto Rotation: Portrait, Landscape.

2.0:

  • ARCameraGYRO prefab (with all stuff inside);
  • AR Shadow (docs) (Without Vuforia packages);
  • Publisher Window (docs);
  • Unity 2017.3.1;
  • AR Background => as independent module;
  • GyroCameraControl.cs not related with GameWorld GameObject.
Unity Asset Bundle

Support for Unity Assets

I am Andrew Sirota, Founder at Makaka Games and full-time Publisher on Unity Asset Store. First of all, read the latest docs online. If it didn’t help, get the support.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Spelling error report

The following text will be sent to our editors: