As an Associate of different 3rd parties, this website earns from qualifying purchases & contains affiliate links: learn more in the footer.

AR Safe Zone & Plane Detection in Unity

Augmented Reality Safety during Plane Detection experience is related to AR Safe Zone. The Player:

  • needs to stay in the Safe Area to avoid accidents during the game and continue the game itself.
  • must be notified when leaving the Safe Zone.

I implemented some examples with Unity Game Engine & AR Foundation (ARKit, ARCore) that provide the Safe Areas with different sizes. Unity Assets with AR Safe Zones you can find in the AR Bundle.

Unity Asset Store — Download Button

Small Size of AR Safe Zone

Safe Area of Small Size is suitable for FPS experience, when you need to execute fast movements, and it is better to stay practically in a static position to avoid any damage to yourself and the environment.

Unity Assets with Small Size of Safe Zone:


Big Size of AR Safe Zone

Safe Area of Big Size is suitable for any experience without fast movements, so the user can smoothly move in the space, but will be limited if the user goes too far. Demo shows AR Gallery (docs).


AR Safe Area in Unity Editor

The next description is relevant for AR Gallery (docs).

Position & Form

By default, the AR Safe Zone is a Transparent Cube that can only be seen from the outside (that is, only when required to alert the player).

The Safe Zone is placed around the Player (AR Camera) on Ground/Floor game object with a real approximate height of 2 meters and a real approximate width of 3.5 meters. It’s enough to place and observe your AR Objects from all sides. You can change the size of the Safe Zone by changing its scale. It’s a Big Size experience.

Option: Every AR Experience is Unique, and you can also place the Safe Zone around the Placed Objects: just delete the function call (one line) in the code which moves the Safe Zone to the Camera position:
the Hierarchy window: $ > ARShadowGalleryControl.cs > arPlaneDetectionControl.MoveObjectXZLocalPosToCamera(AR Safe Zone).

Events

Reactions to Entering and Exiting the Safe Zone can be assigned in the Hierarchy window:
XR Origin > Camera Offset > AR Camera > AR Player: AR Player Control.

It uses OnTriggerEnter(Collider) and OnTriggerExit(Collider) functions.

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 Posts

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