As an Associate of Unity Asset Store, this website earns from qualifying purchases & contains affiliate links: check the footer for more info.

AR Camera Lite — Unity Asset

AR Camera Lite — Unity Asset that uses Back/Rear Camera & Motion Sensor (Gyroscope or Accelerometer) on the player’s mobile device to display 2D or 3D objects as though they were in the real world. Safety First.

It’s Fast, Markerless, Pseudo Augmented Reality.

Unity Asset Store — Download Button

Features of AR Camera Lite

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

  • Cross-platform Mobile AR Camera: iOS, Android.
  • Covering a Wide Range of Mobile Devices: Such pseudo AR can work on low-budget smartphones.
  • No using of other AR Engines like AR Foundation (ARCore, ARKit), Vuforia, etc.
  • Device Orientations: Portrait, Landscape.
  • Auto Selection of Sensor: Gyroscope or Accelerometer.
  • Gyroscope Mode: same AR like in the Pokemon GO game (AR mode, not AR+): 3DoF — it can track rotational motion but not translational.
  • Accelerometer Mode (horizontal rotation is limited): tilting the phone to the left or right rotates the camera around the Y-axis.
  • Instant Launch after granting the camera permission: no need to scan the environment, because there is no surface/plane detection.
  • Quick Testing in Unity Editor without a Phone through the Right Mouse Button & WASDQE keys.
  • Real-Time AR Shadows.

Read more about Top AR Engines for Unity.

Package Contains

  • Demo Scene with Cubes & AR Shadows (docs): shader is included.
  • Menu Scene with AR Safety Tutorial.
  • Permission Scene with Camera Permission Request using free Native Camera.
  • Loading Screen to switch scenes seamlessly.

Check the Map of Unity Assets to choose the product that best suits your needs.

Gyro vs. Accelerometer

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

If the user’s smartphone has a Gyroscope, then it will be used for camera motion first. Otherwise, an Accelerometer will be used, because it has less accuracy & stability than a Gyroscope in the case of AR.

Limitations

Hardware nuances of the gyroscope & accelerometer (asset code does not affect it):

  • Different devices have different sensors, and therefore different deviations and drifts.
  • Drift is natural for the mobile sensors.

Pro Gamer Tip

Accelerometer & Gyroscope are used in games and apps to control gameplay like in PUBG MOBILE game. Sometimes these sensors can be set up incorrectly for some reason & break the gameplay. If you guess that your drift of gyro or accelerometer is not normal, then try to calibrate them with system tools provided by your smartphone manufacturer.

Use Cases of AR Camera Lite

AR Shooter (docs).


AR Basketball (docs).


AR Throw & Score (docs).


AR Throwing (docs).

Tutorial

This tutorial is relevant for AR Camera Lite 4.3+.
Tutorial for the previous version can be found only in the asset folder.

Getting Started with AR Camera Lite

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 New Unity Project with Unity 2021.3.4 & “3D” Template.
  2. File > Build Settings > iOS or Android > Switch Platform.
  3. Next Packages must be manually installed with Git & Unity Package Manager:
    1. Native Camera 1.3.3. Also, check a Hot Fix for v1.3.7.
  4. Download and import AR Camera Lite into Unity.
    1. Warning Windows:
      1. Click “Import” to overwrite the Project Settings with predefined ones.
      2. Click “Install/Upgrade” for Package Manager Dependencies.
  5. Next Packages are provided with Unity Package Manager, and they are already installed for this Asset by default. If packages are missing (Warning Window did not appear) then install them again with Unity Package Manager:
    1. TextMesh Pro 3.0.6:
      1. Always Required: Window > TextMeshPro > Import TMP Essential Resources.
  6. Reopen Unity Project.
  7. Open Scene: Makaka Games > AR > AR Camera Lite > Scenes > Demo.
  8. Test in the Unity Editor or Build for Mobile.

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

Video Tutorial below was made for the previous version of the asset, but it still can be useful to understand how to transform your scene to AR. So use the text tutorial first.

Script Manual

AR Camera GYRO prefab & GyroCameraControl.cs

AR Camera Lite — Unity Asset — Augmented Reality with Gyroscope & Accelerometer

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

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 Initialized

The case when the smartphone has the gyroscope.

Optional Event: On Gyro Is Not Supported

The case when the smartphone has not the gyroscope. By default, you will see a screen message: “Your device does not support gyroscope…”.

Optional Event: On Initialized in Editor

The case when Play Mode in Unity Editor.

Optional Event: On Initialized Not in Editor

The case when Runtime on Device.

Testing

There are 2 ways of testing without building an app:

Testing without the Smartphone

You can test camera rotation quickly in Unity Editor without Smartphone through the Right Mouse Button.

Also, you can use WASDQE keys to move the camera.

Use Fullscreen of Game View in Unity Editor while testing to get a seamless experience.

Accelerometer Instead of Gyro

You can forcibly test Game Version with accelerometer on gyro supported devices:
Hierarchy View > ARCameraGYRO > GyroCameraControl > Is Gyro Unsupported Not In Editor Test > Check, then Build And Run.

Predefined Data

Also, you can start the scene with Predefined Data of position & rotation. It’s a convenient way to frequently testing the same positions and rotations of the camera: “GyroCamera” Game Object.

AR Camera Lite — Unity Asset — Augmented Reality with Gyroscope & Accelerometer —Testing in Editor

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 (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 8, XS Max.
  • Android on Samsung Galaxy A71.

Known issues

Unity AR bugs: Gyroscope

Hardware Issue: INPUT.GYRO.ATTITUDE returns zero values on Motorola Moto G4 and G5.

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).

Zoom Effect of Camera Feed

Zoom Effect in Portrait Mode is related to how Unity gets the camera texture on your phone.

When Camera Texture is not equal to screen size, then the asset automatically zooms it to avoid the black zones on the sides.

You can play with parameters in “Aspect Ratio Filter” Component of “RawImageCameraAsBackground” game object and correct the behavior as you want.

Support

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

Changelog

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

4.3:

Improvements:

4.2:

Features:

  • Menu Scene with AR Safety Tutorial.
  • Event: On Initialized Not In Editor.

Improvements:

  • Preventing Camera Rotation in Update() until the Gyro Is Not Initialized. 
  • Modern Standards of Project Settings (based on New Unity Project).
  • Appearing the Demo Scene from the darkness at Start.
  • Unity 2021.1.20.
  • Native Camera 1.3.0.

4.1:

  • Testing Checkboxes:
    • Is Gyro Unsupported Not In Editor Test,
    • Is Gyro Supported In Editor Test,
    • Is Movement WASDQE In Editor Test.
  • Testing Vector3: Movement WASDQE Speed.
  • Events:
    • On Gyro Initialized,
    • On Initialized In Editor.
  • Native Camera 1.2.9.

4.0:

  • Limited Motion with Accelerometer (will be used if the user device has not Gyroscope).
  • Editor Testing with Right Mouse Button.
  • Using of Native Camera to check Camera Permission before the main scene.
  • Unity 2021.1.0.

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;
  • Fix low FPS in Unity Editor;
  • 2 modes with Auto Rotation: Portrait, Landscape.

2.0:

  • ARCameraGYRO prefab (with all stuff inside);
  • AR Shadow (docs) (shader is included);
  • Unity 2017.3.1;
  • AR Background → as independent module;
  • GyroCameraControl.cs not related with GameWorld GameObject.
Unity Assets

Support for Unity Assets

I am Andrey Sirota, Founder of Makaka Games and full-time Publisher on the Unity Asset Store. First, 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 *

Comment moderation is enabled. Your comment may take some time to appear.

Back to top button