microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6k stars 2.12k forks source link

gltf node id and gameObject pairs #10399

Closed idea-lei closed 2 years ago

idea-lei commented 2 years ago

Describe the problem

till now we only have the whole GameObjectReference in GltfObject, and it's tidious to write own mapping logic to get corresponding GameObject of specific node, because we only have node name under GltfNode (without NodeId of course), meanwhile, some names could be the same. Comparing tranform could be a solution but definitly not elegant...

Describe the solution you'd like

add Node-GameObject-Pairs Dictionary in GltfObject and add the pair during constructing a node (in Method ConstructNodeAsync).

Describe alternatives you've considered

create a method after construction to pair node id and corresponding GameObject. But as mentioned above, this would be relatively complex.

keveleigh commented 2 years ago

I like this idea a lot! Would have definitely simplified some of the controller model visualization code I wrote in the original HoloToolkit. Thanks for the contribution!

keveleigh commented 2 years ago

EDIT: Moving this comment to the PR