Borislav Posted June 27, 2017 Share Posted June 27, 2017 http://cityworld.16mb.com/levels/1/play/preview.html doesn't work... Meanwhile, https://www.babylonjs-playground.com/#2GGCLN works... They have the same script and I used the ZIP button to make the file. Doesn't work. Am I doing Canvas2D incorrectly? I know the readability of the playground is very bad. But, still try. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 27, 2017 Share Posted June 27, 2017 Hello I suggest using GUI instead of canvas2d. But in the meantime you need to reference the canvas2d.js which you can find here: https://github.com/BabylonJS/Extensions/tree/master/canvas2D/dist/preview release Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 28, 2017 Author Share Posted June 28, 2017 11 hours ago, Deltakosh said: Hello I suggest using GUI instead of canvas2d. But in the meantime you need to reference the canvas2d.js which you can find here: https://github.com/BabylonJS/Extensions/tree/master/canvas2D/dist/preview release Ugh, I did this <script src="https://www.github.com/BabylonJS/Extensions/blob/master/canvas2D/dist/preview release/babylon.canvas2d.min.js"></script> <script src="https://www.github.com/BabylonJS/Extensions/blob/master/canvas2D/dist/preview release/babylon.canvas2d.js"></script> <script src="https://www.github.com/BabylonJS/Extensions/blob/master/canvas2D/dist/preview release/babylon.canvas2d.d.ts"></script> Doesn't work Quote Link to comment Share on other sites More sharing options...
jerome Posted June 28, 2017 Share Posted June 28, 2017 What can you see when you click on the link you set in your <script> tag : https://github.com/BabylonJS/Extensions/blob/master/canvas2D/dist/preview release/babylon.canvas2d.min.js ? You can see that Github doesn't serve a js file but a web page. Github doesn't allow to download directly js files (or any other files) from its site like a CDN would do. You have to download the wanted js file and then to host it on your own web server. Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 28, 2017 Author Share Posted June 28, 2017 5 minutes ago, jerome said: What can you see when you click on the link you set in your <script> tag : https://github.com/BabylonJS/Extensions/blob/master/canvas2D/dist/preview release/babylon.canvas2d.min.js ? You can see that Github doesn't serve a js file but a web page. Github doesn't allow to download directly js files (or any other files) from its site like a CDN would do. You have to download the wanted js file and then to host it on your own web server. Ok, but what about raw ones? <script src="https://raw.githubusercontent.com/BabylonJS/Extensions/master/canvas2D/dist/preview%20release/babylon.canvas2d.min.js"></script> <script src="https://raw.githubusercontent.com/BabylonJS/Extensions/master/canvas2D/dist/preview%20release/babylon.canvas2d.js"></script> <script src="https://raw.githubusercontent.com/BabylonJS/Extensions/master/canvas2D/dist/preview%20release/babylon.canvas2d.d.ts"></script> These are not web pages. it is just the plain raw text. Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 28, 2017 Author Share Posted June 28, 2017 4 hours ago, jerome said: What can you see when you click on the link you set in your <script> tag : https://github.com/BabylonJS/Extensions/blob/master/canvas2D/dist/preview release/babylon.canvas2d.min.js ? You can see that Github doesn't serve a js file but a web page. Github doesn't allow to download directly js files (or any other files) from its site like a CDN would do. You have to download the wanted js file and then to host it on your own web server. Is it possible without node.js and npm? Otherwise, it is impossible since node.js can't install due to an error in my pc(Nearly all programs glitch). Quote Link to comment Share on other sites More sharing options...
jerome Posted June 28, 2017 Share Posted June 28, 2017 yep, just download the file here : https://raw.githubusercontent.com/BabylonJS/Extensions/master/canvas2D/dist/preview release/babylon.canvas2d.min.js Save it on your web server with the name canvasd.min.js in the same folder where you already put your html main page. and just add the script tag <script src="canvas2d.min.js></script> in this html page. This should be enough. Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 28, 2017 Author Share Posted June 28, 2017 2 hours ago, jerome said: yep, just download the file here : https://raw.githubusercontent.com/BabylonJS/Extensions/master/canvas2D/dist/preview release/babylon.canvas2d.min.js Save it on your web server with the name canvasd.min.js in the same folder where you already put your html main page. and just add the script tag <script src="canvas2d.min.js></script> in this html page. This should be enough. Okay, i'll try Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 28, 2017 Author Share Posted June 28, 2017 1 hour ago, Borislav said: Okay, i'll try Doesn't work. <script src="https://www.babylonjs.com/hand.minified-1.2.js"></script> <script src="https://preview.babylonjs.com/cannon.js"></script> <script src="https://preview.babylonjs.com/oimo.js"></script> <script src="https://preview.babylonjs.com/babylon.js"></script> <script src="babylon.canvas2d.min.js"> </script> <script src="babylon.canvas2d.d.ts"> </script> <script src="babylon.canvas2d.js"> </script> I downloaded the files to the page. Still, doesn't work. Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 29, 2017 Author Share Posted June 29, 2017 15 hours ago, Borislav said: Doesn't work. <script src="https://www.babylonjs.com/hand.minified-1.2.js"></script> <script src="https://preview.babylonjs.com/cannon.js"></script> <script src="https://preview.babylonjs.com/oimo.js"></script> <script src="https://preview.babylonjs.com/babylon.js"></script> <script src="babylon.canvas2d.min.js"> </script> <script src="babylon.canvas2d.d.ts"> </script> <script src="babylon.canvas2d.js"> </script> I downloaded the files to the page. Still, doesn't work. Please help. Quote Link to comment Share on other sites More sharing options...
jerome Posted June 29, 2017 Share Posted June 29, 2017 Please open your browser console (F12) and check in the network tab what is downloaded and what is not. Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 29, 2017 Author Share Posted June 29, 2017 20 minutes ago, jerome said: Please open your browser console (F12) and check in the network tab what is downloaded and what is not. Uncaught TypeError: Cannot read property 'getEngine' of undefined at ScreenSpaceCanvas2D.Canvas2D [as constructor] (babylon.canvas2d.js:17000) at new ScreenSpaceCanvas2D (babylon.canvas2d.js:18776) at create (preview.html:41) at createScene (preview.html:134) at preview.html:370 Quote Link to comment Share on other sites More sharing options...
jerome Posted June 29, 2017 Share Posted June 29, 2017 what's in the network tab ? Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 29, 2017 Author Share Posted June 29, 2017 17 minutes ago, jerome said: what's in the network tab ? @jerome Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 29, 2017 Author Share Posted June 29, 2017 12 minutes ago, Borislav said: I removed the min.js edit: added it back, still doesn't work. Quote Link to comment Share on other sites More sharing options...
jerome Posted June 29, 2017 Share Posted June 29, 2017 1) did you check that they were all rightly downloaded (status code 200) ? 2) Is your own code starting well after all these downloaded scripts ? Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 29, 2017 Author Share Posted June 29, 2017 8 minutes ago, jerome said: 1) did you check that they were all rightly downloaded (status code 200) ? 2) Is your own code starting well after all these downloaded scripts ? @jerome 1. Yes, status code 200, and 304. 2. It DID work in playground, so that means everything is correct right? Everything is correct! Quote Link to comment Share on other sites More sharing options...
jerome Posted June 29, 2017 Share Posted June 29, 2017 304 just means "not modified", so the browser uses the cached version instead of re-downloading the file. Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 29, 2017 Author Share Posted June 29, 2017 @jerome I did it!!! It was a typo I just noticed while doing something! YAAAAAYYYY!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.