ARFounation for multiple objects - performance consideration

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 !! :slight_smile: I couldn’t see any different suggestion in ARF’s git PlaceMultipleObjectsOnPlane.cs

Cheers
Unity 2019.1.3, ARF 2.1

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.

1 Like