In the ARCore tutorial, if you recognize a plane with the camera and touch it, you will create an object, and if you recognize another plane, you can create another object there. However, I want to recognize one plane and create an object, then stop the plane recognition and hide the already recognized range at the same time.
The algorithm is as follows: Recognize the floor -> Create the object by touching the recognized range -> Stop the plane recognition, hide the first recognized range, and leave only the object.
I have succeeded in creating only one object and preventing the creation of additional objects. But I do not know how I should touch the code anymore ... Please help me.
To stop plane recognition, you have to access the ARCore session config
// If you are using ARCore 1.2
FindObjectOfType<ARCoreSession>().SessionConfig.PlaneFindingMode = DetectedPlaneFindingMode.Disabled;
// If you are using a previous ARCore version
FindObjectOfType<ARCoreSession>().SessionConfig.EnablePlaneFinding = false;
To hide the already tracked planes, you need to find them and disable their mesh renderer. In ARCore, you could do something like this (I have not tested this)
DetectedPlaneVisualizer[] detectedPlanes = FindObjectsOfType<DetectedPlaneVisualizer>();
for(int i = 0; i < detectedPlanes.Length; i++)
{
detectedPlanes[i].transform.GetComponent<MeshRenderer>().enabled = false;
}
However, you could use an ARCore plugin I wrote to make development easier. With that, you can just use one line of code to disable tracked planes
EazyARCoreInterface.VisualizeDetectedPlanes = false;