Hi!
How can I remove the viewer once I have placed the content on the surface? and cancel the touches to be able to use your own canvas with buttons in the GUI.
Regards!
Hi!
How can I remove the viewer once I have placed the content on the surface? and cancel the touches to be able to use your own canvas with buttons in the GUI.
Regards!
Hi.
Today, almost a year after your message, I’m having the same problem. Did you find the solution for the current version of ARFoundation?
Thanks.
Hi tonymnoz!
Hello. I think I found the Solution in Unity 2018.2
In the script PlaceOnPlane.cs
…
void OnPositionContent(){
if (Input.touchCount > 0)
{
Touch touch = Input.GetTouch(0);
if (m_SessionOrigin.Raycast(touch.position, s_Hits, TrackableType.PlaneWithinPolygon))
{
Pose hitPose = s_Hits[0].pose;
if (spawnedObject == null)
{
spawnedObject = Instantiate(m_PlacedPrefab);
DisablePlanes();
}
else
{
spawnedObject.transform.position = hitPose.position;
}
}
}
}
void DisablePlanes(){
planeManager.GetAllPlanes(allPlanes);
planeManager.enabled = false;
foreach (ARPlane plane in allPlanes)
{
plane.gameObject.SetActive(false);
}
}
When you place your content disable the ARPlaneManager and clean the generated planes visualized
planeManager is the ARPlaneManager component you have to turn off
planeManager = GetComponent();
Then get the generated plane meshes and clean them as shown in DisablePlanes()
I hope it helps!
Regards
Edu
I forgot to mention that I’ve only tried it on iOS. I guess Android will also be valid.
And I’m sure that this can be implemented in some other way more effective
Regards
Thank you. That was it. I misunderstood GetAllPlanes code. I thought that, like it was a void, I couldn’t use it without changing that code. And I didn’t want to do that for the future updating implications it carries.
In fact, everything was centered on the DisablePlanes method. Unity should include that code in the library. I only made a small update to yours. I’m sharing it for whoever needs it:
void DisablePlanes()
{
planeManager = GetComponent<ARPlaneManager>();
List<ARPlane> allPlanes = new List<ARPlane>();
planeManager.GetAllPlanes(allPlanes);
planeManager.enabled = false;
foreach (ARPlane plane in allPlanes)
{
plane.gameObject.SetActive(false);
}
}
Thanks a lot. Perfect.
yes, the GetAllPlanes need to create a new list of ARPlanes to be given to the GetAllPlanes and be able to obtain them in such a way that you turn them off.
Thank you!
@Edur-Games @tonOnWu
Hey guys
On IOS, did you lose tracking for a few seconds after you disabled the pPlaneManager
Cheers