jeudi 27 juillet 2017

Random Aframe environment

I want to have random scenarios every time I enter the website. So I'm trying to return the "pickscenario" variable from the js script to aframe:

<a-entity environment="preset: pickscenario"></a-entity>
        <script>
          var scenarios = ['ocean', 'universe', 'forest'];
          var pickscenario = scenarios[Math.floor(Math.random()*scenarios.length)];
          return pickscenario;
        </script>        
  </a-entity>

I bet this is quite simple but I haven't figure it out yet.




Aucun commentaire:

Enregistrer un commentaire