I am trying to set up a very simple AR Core scene for work, and for some reason the app fails to find any planes. The only type of ARRaycastHit it finds are feature points. I have a simple scene with the ARSession and ARSessionOrigin objects, a quad for indicating the placement point, and a gameobject for holding my interaction function. (There's also a canvas with text for debug output.) Unity version: 2018.3.0f.2 AR Foundation: 1.0.0-preview.22 ARCore XR Plugin: 1.0.0-preview.24 ARKit XR Plugin: 1.0.0-preview.27 Here's the code I'm using to locate planes and move my location indicator. Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.XR.ARFoundation; using UnityEngine.Experimental.XR; using System; using UnityEngine.UI; public class ARTapToPlaceObject : MonoBehaviour { public GameObject placementIndicator; public Text debugString; private ARSessionOrigin arOrigin; private Pose placementPose; private bool placementPoseIsValid = false; // Start is called before the first frame update void Start() { arOrigin = FindObjectOfType<ARSessionOrigin>(); } // Update is called once per frame void Update() { UpdatePlacementPose(); UpdatePlacementIndicator(); } private void UpdatePlacementPose() { var screenCenter = Camera.current.ViewportToScreenPoint(new Vector3(0.5f,0.5f)); var hits = new List<ARRaycastHit>(); arOrigin.Raycast(screenCenter, hits, TrackableType.All); placementPoseIsValid = hits.Count > 0; if (placementPoseIsValid) { placementPose = hits[0].pose; debugString.text = hits[0].pose.position.ToString() + "," + hits[0].hitType; } else { debugString.text = "No valid placement surface"; } } private void UpdatePlacementIndicator() { if (placementPoseIsValid) { placementIndicator.SetActive(true); placementIndicator.transform.SetPositionAndRotation( placementPose.position, placementPose.rotation); } else { placementIndicator.SetActive(false); } } } The code works perfectly when it finds a feature point, but that's all it will find.
I just tried this project out with a different version of Unity and ran into the same problem. It finds feature points just fine, but cannot seem to determine where flat surfaces are. This attempt: Unity: 2019.1.0a12 AR Foundation: 1.1.0-preview.6 ARCore XR Plugin: 1.0.0-preview.24 ARKit XR Plugin: 1.0.0-preview.27
I am using: Unity: 2019.1.0f2 AR Foundation: 2.1.0-preview.3 ARCore XR Plugin: 2.1.0-preview.5 ARKit XR Plugin: 2.1.0-preview.5 and I have exactly same problem. Any ideas on why and how to fix this?