Skip to content

Brainstorming <a-define-template> #2600

@nikgraf

Description

@nikgraf

I recently started playing with A-Frame. Awesome tool! My favourite feature the inspector. Also the entity component system is so powerful.

As someone coming from React I had a hard time re-using existing structures e.g. a tree build out of a tree trunk and tree crown object. I found a repository with various examples, but I was wondering if this concept makes sense in the core.
Here my outcome so far: https://github.com/nikgraf/webvr-experiments/blob/master/a-frame/v3-forest/index.html#L11-L16

I was thinking about this:

<a-define-template id="tree">
  <a-obj-model src="assets/tree-crown.obj" mtl="assets/tree-crown.mtl" position="0 2.5 0"></a-obj-model>
  <a-obj-model src="assets/tree-trunk.obj" mtl="assets/tree-trunk.mtl" position="0 0 0"></a-obj-model>
</a-define-template>

<a-entity template="tree"></a-entity>

Does that make sense for A-Frame?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions