Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
2.98k stars 1.11k forks source link

Is it possible to use both front and back camera at the same time #1046

Closed jerrytamchiho closed 1 year ago

jerrytamchiho commented 1 year ago

Right now I have 2 XR Origins. 1 AR Camera Manager has the "World" facing setting and the other one has the "User" facing setting. For the front camera XR Origins i have added a ARFaceManager running and for the back one i have added a ARPlaneManager. However, when deployed onto android phone both are Cameras are using the "User" Camera. The ARFaceManager works correctly on the XR Origin with ARFaceManager on. So it seems maybe the ARFaceManager somehow overrides the settings for the "World" ARCameraManager? or is it not possible to use both cameras at the same time. Thank you very much.

andyb-unity commented 1 year ago

From our docs:

You should only enable one manager of the same type in a scene at any given time. Enabling more than one instance of a manager can result in undesirable behavior, as each manager instance will interact with the same underlying subsystem.

Managers are C# interfaces to the underlying platform implementations of AR features. If you have multiple managers active in a scene at once, they will conflict with each other, as they both read and write to the same platform API.

To specifically answer your question, neither ARCore nor ARKit support live video from both World and User cameras simultaneously. However, ARKit supports simultaneous face tracking from the front-facing camera while the Camera subsystem is in the world-facing configuration. For more information on that ARKit configuration, see our sample: https://github.com/Unity-Technologies/arfoundation-samples#rear-camera-arkit

jerrytamchiho commented 1 year ago

Thank you very much for your reply. Understood.