Hi! I transformed a cart game but failed to embed it using the attached code. Am I missing something in the html portion? I suspect there is something that it didn’t like with the Ammo.js.
FYI, The portion from /******* Add the create scene function / to /* End of the create scene function ******/ loads fine inside Babylon.js.
I’m not sure if you checked the console at all, but there are a couple of issues.
You made your createScene async so at the end where you call var scene = createScene() you’re actually defining scene as a Promise. So you actually have to do this:
createScene().then(scene => {
// Register a render loop to repeatedly render the scene
engine.runRenderLoop(function () {
scene.render();
});
// Watch for browser/canvas resize events
window.addEventListener("resize", function () {
engine.resize();
});
});
keydown and keyup are not defined when you are adding the window event listeners, either define those functions or remove those lines.
Sorry to bother you again, but I have another example that has a similar situation. The screen is blank. Maybe you can take a quick look. The code is copied from one of BabylonJS examples:
JSFiddle should still have console errors, from what I can tell it looks like something to do with the GUI instantiation which I’m not terribly familiar with.