John Does

  • Content Count

  • Joined

  • Last visited

  1. I have no particular problem,but I was wondering... Wouldnt I be able to use the while statement instead of using the built-in animation. And if the while statement were to work, wouldnt be faster than the built-in animation?
  2. While I was learning the documentation I decided to experiment with the code for a bit. and I encountered a problem. I attempted to make a function that makes a new box, then I would make an HTML Button and when clicking this button the function that I made should be triggered and a box should appear on the screen. Since this didnt work I decided to see if you guys could possibly help me. Here is the code: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Babylon.js sample code</title> <!-- Babylon.js --> <script src=""></script> <script src=""></script> <script src=""></script> <script src=""></script> <style> html, body { overflow: hidden; width: 100%; height: 100%; margin: 0; padding: 0; } #renderCanvas { width: 100%; height: 100%; } #mainDiv { background-color: green; width: 100px; height: 100px; position: relative; bottom: 300px; } </style> </head> <body> <canvas id="renderCanvas"></canvas> <script> var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); var createScene = function () { var scene = new BABYLON.Scene(engine); var camera = new BABYLON.FreeCamera("VJ_camera", new BABYLON.Vector3(0, 1, 0), scene); camera.attachControl(canvas, true); var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene); var ground = BABYLON.Mesh.CreateGround("ground1", 100, 100, 2, scene); function random() { var box = new BABYLON.Mesh.CreateBox("box1", 2.0, scene); } return scene; }; var scene = createScene(); engine.runRenderLoop(function () { scene.render(); }); // Resize window.addEventListener("resize", function () { engine.resize(); }); </script> <div id="mainDiv" > <button onclick="random()">A button</button> </div> </body> </html> I'm new to Babylon and also to this forum, though I checked my code several times there might be something that I missed. And I will say this ahead of time. Thanks!