I’ve looked around to see if there was this functionality and the only thing I found somewhat related to this issue is this thread from 2014. From what I can see, tags were implemented because of the conversation, however the main thing OP asked for was not elaborated on. Tags are useful, but in my use case, not useful enough. I would need a direct equivalent of three.js Object3D.userData.Was the serializable userData object ever implemented and I am just missing it or was it never realized?
1 Like
If you are using javascript you can just set it as you wish If you use typescript, you can always use
metadata
:
https://doc.babylonjs.com/api/classes/babylon.abstractmesh#metadata
1 Like
Thanks, I guess I needed to more thoroughly read the documentation . I guess the issue was lack of it standing out.
I know that if you use metadata anything you add via this will be serializable as metadata is. If you use Javascript and just set a new property rather than going through metadata, is this serializable? eg
mesh.metadata = {};
mesh.metadata.heightReached = 100;
will serialize
will
mesh.heightReached = 100;
serialize? I thought not.
No, it won’t.
The documentation of the userData
is:
An object that can be used to store custom data about the Object3D. It should not hold references to functions as these will not be cloned.
So - it is just a placeholder, just like any other object.
1 Like