[SOLVED]Spatial’s User Data and Control fields

Hello, I have a question about this thing, what is the difference / advantage between user data added to a spatial and the same data as a field in the inherited class AbstractControl? I have found that one instance of a control can not be added to more than one spatial, then from there my question, use user data added to a spatial or fields within the class control?



Thanks.

The advantage of user data is that they can be serialized with the spatial in a j3o file (and edited in the SDK btw).

In this case if the data are generic enough so you can have them in a control and are not proper to a model , then you should use attributes of the control.



Using several instance of the same control for several objects is not a problem, but if that really bothers you you can group all the spatial that should share the control in a parent node, attach the control to this node, and iterate over its children and do w/e the control is supposed to do.

Thanks you for reply my question, is a good idea to group all the spatials in a node and attach a control to it, I will implement this in my proyecto.



Bye.