Plane detection in world tracking mode
Is there any way to detect planes (especially horizontal planes like the ground and table surfaces) while in world tracking mode? There are some classes described in the documentation for which I cannot find any example usage: TrackedPlane and TrackedPoint. TrackedPlane's documentation references a WorldTrackingPlanesAddedEvent but I've tried subscribing to this event and it never fires (nor does Lens Studio's IDE even seem to know about it).
My use case is that I'd like to have a relatively free roaming game but be able to place enemy units on the ground and other surfaces. Additionally, I would like to have the shadow plane on the ground.
LiDAR enabled devices can detect multiple surfaces. But for widespread support you are limited to tracking just the ground or other horizontal surfaces (only with the rear camera).
The easiest way to add this is to add the "World Object Controller" which is found in the Helper Scripts section if you are adding something to the Objects Panel. This will add the script and some example objects to your scene. Once added, select the script and set the device tracking input and you should be good to start playing around with it.
Example template: https://lensstudio.snapchat.com/templates/interactive/animated-object-2021/
Thanks! If I'm not mistaken, this is intended for attaching to a single horizontal plane. Rather, I would like to be able to track all horizontal planes. I've managed to do this using the raw events (there are 3 plane events, two of which are completely undocumented but do exist).
One problem is that there is no way to raycast against planes. I can write my own quad/ray intersection test for planes approximated as a rectangle but the estimated plane geometry is not accessible (there appears to be no way to extract vertices from a provided mesh).
Is there some other intended workflow for this?
Hi Bart,
I was wondering, because of your name, if you are based in Belgium or the Netherlands?
I'm based there too and always good to connect with local creators :)
Best,
Bruno
Hi Bruno,
I heard the name Bart is quite common in that part of the world :) But alas, I am located in the US (Nevada). That said, I may be visiting the Netherlands next summer!
Re: planes, I discovered that plane detection does work in world tracking mode and that one needs to subscribe to the plane update events (which are essentially undocumented).
Bart