mercredi 27 juillet 2016

What is the best way to have multiple components of a single type?

For example I want to generalize my existing trigger box component.

I use currently it the following way

<a-camera triggerbox="triggereventname: mytriggerbox"></a-camera> 

but instead I would like to be able to have

<a-camera triggerbox1="triggereventname: SmTB; x0: -20; y0: 0; z0: -20; "
triggerbox2="triggereventname: LgTB; width: 10; height: 10; depth: 10;"
></a-camera> 

and have multiple trigger boxes, not just one, attached to the camera (or any other element).

Unfortunately all the solutions I think of (e.g. re-registering the component with different names for each instance) are horribly ugly. What is the proper way to solve this?

Aucun commentaire:

Enregistrer un commentaire