Closed ChangweiZhang closed 7 years ago
Does using a layer and layermasks not work better for the same objective?
Looking through SpatialMappingSource
where SurfaceObjects
are added in AddSurfaceObject
they are added to the layer specified by SpatialMappingManager.Instance.PhysicsLayer
. This looks to be controllable through the editor.
Are these the surface objects you're referring to? If so, can you filter by that physics layer for your use case?
As @jwittner suggests, you can use the collision layer to detect if an object is part of the spatial mapping mesh. For my applications, I like to create an empty game object called 'Spatial Mapping' in my scene, that I then parent all of the spatial mapping game objects to (the 'SpatialMapping' prefab in HoloToolkit will automatically parent the meshes to itself). Then, if I want to get the meshes, I just need to look for that parent object to find them.
Tags are very convenient when working in your own application (and you can certainly modify the SpatialMapping code in your own application to add a tag whenever a new mesh is created). However, tags do not export to other projects. So, even if we were to create a 'SpatialMapping' tag in the 'HoloToolkit', all users would have to manually add that tag to their project to take advantage of it. Because of this limitation, we avoid using tags in prefabs and code that is meant to be shared across multiple projects.
Totally agree with @jwittner and @angelaHillier. Tags would break the scenario of create a unity package of the toolkit and import into another project. Or just copy code that depends on tags.
Thank you, guys. Layer is actually better than tag. Happy Mid-autumn Festival
As we all know, there are losts of surface objects which will be ctreated after we use Spatial Mapping. Maybe it will be better if Spatial Mapping create those surface objects with a special tag? Because we always use gestures or gaze, a special tag will help us select the right object