As an Associate of Unity Asset Store, this website earns from qualifying purchases and 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.

Features of AR Camera Lite

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

Read more about Top AR Engines for Unity.

Package Contains

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

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:

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

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.

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:

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:

Improvements:

4.1:

4.0:

3.3:

3.2:

3.1:

3.0:

2.0:

Exit mobile version