Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Switching between UserCamera and WorldCamera while using ARFaceManager

Discussion in 'AR' started by rsjowell, Nov 3, 2021.

  1. rsjowell

    rsjowell

    Joined:
    Jun 15, 2019
    Posts:
    4
    Hi, I'm working on an app that needs just the Face Pose feature of AR Foundation through the WorldCamera. I've seen this work in the arfoundation-samples project, however, I cannot get it to work on my own project. I notice in the Sample project that the scene starts out with the UserCamera, and you have to touch the screen to turn to the WorldCamera with Face Pose, so I guess it will work after a few frames have passed. Is there some way to start the scene with Face Pose on the Rear Camera? I've tried to call the "requestedFacingDirection" on my camera, and it works when FaceManager is not enabled, but when I re-enable it, it works fine. What background process do I need to wait for in order to achieve this?
     
  2. rsjowell

    rsjowell

    Joined:
    Jun 15, 2019
    Posts:
    4
    So after some playing around, I found out that when FaceManager is active, you can only switch to the World-Facing camera AFTER the first frame has passed. I wrote a co-routine fired in the Start() method as follows:

    Code (CSharp):
    1. IEnumerator switchCamera()
    2. {
    3.  
    4.     yield return null;
    5.     yield return null;
    6.     camManager.requestedFacingDirection = CameraFacingDirection.World;
    7.  
    8. }
     
  3. todds_unity

    todds_unity

    Joined:
    Aug 1, 2018
    Posts:
    324
    You should be able to start with the CameraFacingDirection.World and the face tracking manager enabled. There was a bug related to this in earlier versions of AR Foundation.

    If you are still encountering this issue, please file a bug.
    https://unity3d.com/unity/qa/bug-reporting