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 ARFoundation Android body masking workaround

Discussion in 'AR' started by spelafort, Jun 10, 2021.

  1. spelafort

    spelafort

    Joined:
    May 8, 2017
    Posts:
    37
    Hi all,

    I'm using ARfoundation and trying to roughly mask out human bodies by superimposing an image in front of them. Since Android doesn't support pose detection, and because I don't care about poses in this case, my workaround has been to use face detection and raycast downwards towards a groundplane in order to get a height, then try to create a dynamically scaling gameobject with the image on a child canvas. What I would like is for the image to stay 'grounded' (stick to the ground plane) and to dynamically scale so it covers the detected person's entire body.

    What I've tried: creating an encapsulated bounding box from two colliders (head and 'feet'), then scaling my bodymask game object by the size of the bounds. But this leads to really wacky results.

    So I'm wondering: is this approach on the right track? Or is there something else I could be looking at here?

    The basic problem is that I'm operating somewhere between the three frames of reference (canvas, local, and world), and I'm having a tough time translating between them in a useful way. I'm posting here in the hopes that someone can point me in a more fruitful direction or give me some new and more elegant ideas for approaching this.

    Any help appreciated!