Disable Point Cloud particles/visuals
I want to start the AR Planar experience with the Point Cloud displaying the particles, but I want to turn them off after a few seconds (when the user places an object). In ARFoundation 1 I did this ->
pointCloudManager.pointCloud.GetComponent<ARPointCloudParticleVisualizer>().enabled = false;
And that worked. But now ARFoundation has more than one point cloud. I've tried adding a listener an enumerating over the added and updated points. But that doesn't work.
private void PointCloudsChangedHandler(ARPointCloudChangedEventArgs eventArgs)
{
for (int i = 0; i < eventArgs.added.Count; i++)
{
eventArgs.added[i].GetComponent<ARPointCloudParticleVisualizer>().enabled = false;
}
for (int i = 0; i < eventArgs.updated.Count; i++)
{
eventArgs.added[i].GetComponent<ARPointCloudParticleVisualizer>().enabled = false;
}
}
And tips?
Try deactivating the point clouds' GameObjects instead. The visualizer enables or disables the particle system based on the tracking state each time it is updated.
If you don't need the point clouds at all anymore (i.e., you aren't also using the data in some other way), the better way to do what you want would be
ARPointCloudManager pointCloudManager = ...
// Stop updating point clouds
pointCloudManager.enabled = false;
// Disable each existing one
foreach (var pointCloud in pointCloudManager.trackables)
{
pointCloud.gameObject.SetActive(false);
}
thank you. that worked.
Great! I'll close this issue.
Thank you.