Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity wants to learn about your experiences working on a Unity project today. We'd like to hear from you via this survey.
    Dismiss Notice
  3. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  4. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  5. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

Creating UI bounding boxes/target boxes around objects

Discussion in 'AR/VR (XR) Discussion' started by RogueStargun, Sep 19, 2020.

  1. RogueStargun


    Aug 5, 2018
    Anyone have any idea on the proper way to do this in VR? I'm making an x-wing style game with target boxes around the enemies.

    I wrote bounding box code that draws sprites on a Screenspace overlay UI canvas, but this code does not work in VR because it seems that cam.WorldToScreenPoint and cam.WorldToViewport don't seem to work consistently in VR.

    I also thought about attaching a canvas to every object that needs a bounding box, but there are downsides to this (performance, objects occluding the billboarded canvases)

    What would be the best solution for this use case?