Closed asteurba closed 3 years ago
What I'm trying to do now is instead of having the polygon shape of the plane, I'd like to have a rectangle that is basically a bounding box around the polygon.
You could use a planar mesh (GameObject > 3D Object > Plane) for your plane prefab and adjust its transform's localScale accordingly.
This is effectively what we did in very early versions, before boundary geometry was available. Note that the planar mesh is 10m x 10m, but the ARPlane's size is provided in meters, so you'll need to divide by a factor of 10 when you scale it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi, thanks a lot for the fast response and apologies for my late one! Thanks for the pointers, got a semi working version going now, needs a bit of tweaking but I'll get there!
Hi, I'm pretty new to ARFoundation and Unity/C# in general, so this might be easier than I think.
Anyway, for a project I trying to catch the first plane that the ARPlaneManager detects, only show it when it reaches a certain size (2 sqm fe) and not show the rest. This I have managed so far by adding an extra script to my Session Origin that subscribes to ARPlanesChangedEventArgs, grabs the first added plane, storing it and then subscribing to the ARPlaneBoundaryChangedEventArgs of that plane to see whether it's large enough.
The making visible of that specific plane based on size and the rendering invisible of all the subsequent planes I did by making a custom ARPlaneMeshVisualizer that holds an extra visiblePlane bool which is standard set to false (and basically prevents any plane from rendering unless I set it to true).
What I'm trying to do now is instead of having the polygon shape of the plane, I'd like to have a rectangle that is basically a bounding box around the polygon. I thought I'd be able to do this by creating a NativeArray that basically holds a square and pass that to OnBoundaryChanged in the custom ARPlaneMeshVisualizer, instead of the boundary of the plane, but so far no luck. Am I on the right path or making this too complicated for myself?
If any more clarification is needed, or I have to adjust my post, let me know! Thanks in advance!
Script to catch first plane and check for size:
Custom ARPlaneMeshVisualizer: