1. daniel3217's Avatar
    I am just beginning a little fun project and have come to a point where I want to have a bunch of trees (50 or more) in the scene

    The obvious (naive) way is a ton of <a-entity ...> components in the html. The programmer in me flinches at this point. Any update will require picking through the html to make the changes

    A simple (heavy handed) solution would be for the tree data to be in one file and a preprocessor generate the necessary <a-entity ...> elements. A simple solution which would be easy to update but feels half hearted

    The better solution would seem to be having the data in a Javascript list and use Javascript to generate the trees and skip the <a-entity ...> in the html altogether. Not really sure where to look to see how to do this and it seems to be pointing to a larger terrain / level map type of solution which might be overkillwhatsapp web 192.168.0.1 routerlogin


    Am I overthinking this?
    Last edited by daniel3217; 01-01-2020 at 07:24 PM.
    12-30-2019 04:23 AM
  2. pkcable's Avatar
    12-30-2019 03:42 PM
  3. KermEd's Avatar
    A simple (heavy handed) solution would be for the tree data to be in one file and a preprocessor generate the necessary <a-entity ...> elements.
    It has been a long time since I used A-frame, and it is constantly improving and progressing. Normally I use a more abstract game engine like framework (i.e. playcanvas or BabylonJS) so I don't have to write as much code.

    I'd check if there is a terrain generator for aframe already that you can feed the models to.

    The game-engine way, is to create an image map, and use that to create your terrain locations and positions, but they can be Overkill.

    What I will say is if you can read that info from json - you could theoretically move it to a server later for multiplayer, use it in some kind of editor, or post release update stuff.
    pkcable likes this.
    12-30-2019 03:49 PM
LINK TO POST COPIED TO CLIPBOARD