Search Unity

ARFounation for multiple objects - performance consideration

Discussion in 'AR' started by Tarrag, Aug 6, 2019.

  1. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    215
    Hey all,
    The way I raycast to multiple objects is first check I hit an object via Physics.Raycast(ray, out hit, 100, layerMask)) but then it follows with Raycast(touch, s_Hits, TrackableType.PlaneWithinPolygon))

    This lets the user move a different object straight away without having to first select it.

    But it also requires two raycasts weighting on performance. Unfortunately I'm taking these two steps because ARRaycastManager only masks to trackables.

    Wouldn't it make more sense for ARRaycastManager use physics (I think that's the way it used to be and reuse the hit.collider properties) ? much of AR is about moving objects.

    Or maybe there is a simpler way - please share then !! :) I couldn't see any different suggestion in ARF's git PlaceMultipleObjectsOnPlane.cs

    Cheers
    Unity 2019.1.3, ARF 2.1
     
    Last edited: Aug 6, 2019
  2. BuoDev

    BuoDev

    Joined:
    Nov 28, 2018
    Posts:
    45
    In TouchPhase.Began I raycast against objects for selection purposes. Only in TouchPhase.Moved do I get the pointcloud or raycast against trackables with the ARRayastManager's Raycast method.
     
    Tarrag likes this.