Is there a way to raycast from character avatar down to floor of detected AR plane? I’m trying to detect if the avatar is close to the detected plane (e.g. a detected table) or not.
Normally I would use ARSessionOrigin Raycast for detecting planes, however I disabled the ARPlaneManager after initial scanning of the room in the script. After the ARPlaneManager gets disabled, the raycasting is still running but seems to not behave properly because after disabling the plane manager it detects planes in the real world that were NOT detected during the initial detection phase, i.e. when the plane manager was enabled.
Clarification: In my app I have an arrow indicator that will paint itself onto a detected surface. During initial scanning the app will detect a table and then I disable plane manager. However when I look at the floor after plane manager was disabled, the arrow indicator is painting itself on the ground even though the ground was not detected (I know it was not detected since an “AR Default Plane” was not created on the floor). The code below works perfectly when the AR Plane Manager is enabled, i.e. the indicator will stop painting once i look off of a detected plane, but once the manager is disabled it gets the behavior I described above:
arOrigin.GetComponent<ARRaycastManager>().Raycast(screenCenter, hits, UnityEngine.XR.ARSubsystems.TrackableType.PlaneWithinPolygon);
I tried with Physics.Raycast from my avatar since the planes being generated have mesh colliders (I’m generating the visualizations using “AR Default Plane” in the AR Plane Manager component inside the AR Session Origin object). However, it’s not detecting the ARPlanes. I know my raycast is set properly since I generated a cube 3D game object under the player avatar as a test and it detects the raycast then.