Presence platform - how to iterate over scene objects

I’m new to needle and I want to try and start using it for some experiences i’m thinking of. First, I want to find out where the walls are, and do something simple like placing photos over the walls.

in Unity i would iterate over the scene maneger and see if something is a wall and do some manupulation ot determine where i’m sticking those images.

how do i go about doing that in Needle?

Original Post on Discord

by user 1081953198014734357

You can either use the threejs methods like this.gameObject.traverseVisible three.js docs

Or you can iterate over all renderers like in Unity with e.g.
for(const rend of this.gameObject.getComponentsInChildren(Renderer) (or GameObject.findObjectsOfType(Renderer))

how do i know if an object is a SceneAnchor object?

by user 1081953198014734357

By SceneAnchor you mean e.g. a wall (or a plan) spawned by plane tracking? Or do you mean webxr anchors?

wall, table, etc. (Unity Scene Overview: Unity | Oculus Developers)

by user 1081953198014734357

As far as I know there’s nothing like that in WebXR builtin yet for schemantic scene understanding. Perhaps @herbst🌵 knows more here

That’s actually a good question. I’ll double check

So not right now but got a response from Meta:

The next version of the browser (27.2) will have semantic labels on the planes as an experiment

That being said, finding walls is relatively easy @SoundGuy2 as these are always “vertical planes at full height” on Quest / Quest Pro.

For my own reference for adding this as soon as it’s available on Quest: updated spec

@SoundGuy2 Quest browser 27.2 has now shipped with experimental support for semanticLabels.
To quickly try it out, you can

  • ensure your browser is on 27.2+
  • make sure to turn on the “WebXR Experimental Features” flag in chrome://flags on Quest
  • use this to get the type of object on the wall quad:
start() {
        const tracker = GameObject.findObjectOfType(WebXRPlaneTracking);
        if (tracker) {
            const planes = tracker.trackedPlanes;
            for (const plane of planes) {
                //@ts-ignore
                if (plane.mesh === this.gameObject) {
                    const data = plane.xrPlane;
                    //@ts-ignore
                    console.log("this plane is part of a ", data.semanticLabel);
                }
            }
        }
}

Thanks, I will check it out soon.

by user 1081953198014734357