Does / should scene.getTransformNodeByName() have meshes returned

Am trying to supply an XR feature, WebXRAnchorSystem, with an option of type TransformNode. A Mesh inherits from TransformNode, so in theory getTransformNodeByName() would find a mesh if the name were passed.

I am in doubt that would happen though. Thought I would get an explicit answer, rather than scrape an answer based on a reading of source code. TransformNode got added for GLB files, & that is not my strongest area.

Would scene.getNodeByName() suit your needs?

1 Like

I saw that right above getTransformNodeByName(). It would work, though maybe all Nodes are not TransformNode.

This is not so much a technical question, as what is intended with this set of getters coverage wise?

1 Like

Looking at the code, the only places that call addTransformNode are the TransformNode constructor itself and the AssetContainer. And by this example, getTransformNode by name will indeed only return this class, not its subclasses like Mesh: getTransformNodeByName | Babylon.js Playground (babylonjs.com)

1 Like

Thanks guys for looking at this. When TransformNodes came to be, they set the look up rules, but did not take the subclasses into account.

I am writing deployment configuration code. Do not want to have to mess around going back for scope issues. I’ll just write / steal my own, which takes the widest knowable case. It is not that much to do.

1 Like