Ahiru Posted October 2, 2015 Share Posted October 2, 2015 I tried to include some external scripts into the playground, and while it seems that Cannon.js works, Socket.IO does not - does anybody have an idea why? http://www.babylonjs-playground.com/#1YGCVH#3 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted October 2, 2015 Share Posted October 2, 2015 Socket.IO, NodeJS... is not referenced in the playground Quote Link to comment Share on other sites More sharing options...
Ahiru Posted October 2, 2015 Author Share Posted October 2, 2015 NodeJS will be on the server anyway, not on the client - but Socket.IO I just included per CDN in line 5 The including per CDN seems to work, since the CANNON.World() works. Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 2, 2015 Share Posted October 2, 2015 I believe it is due to the requirejs-style initialization of socket.io . But I might be wrong :-) Quote Link to comment Share on other sites More sharing options...
Ahiru Posted October 2, 2015 Author Share Posted October 2, 2015 Hmm - on my server: index.js: <script src="https://cdn.socket.io/socket.io-1.3.7.js"></script> <script src="/main.js"></script>main.js:... var socket = io();And it works: http://it-devils.com:3000/ Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 2, 2015 Share Posted October 2, 2015 No idea then... Quote Link to comment Share on other sites More sharing options...
iiceman Posted October 2, 2015 Share Posted October 2, 2015 Does it work like that: http://www.babylonjs-playground.com/#1YGCVH#6 Edit: at least it did when I tried and hit Run a second time... doesn't seem to work on the first load, tho. Edit2: nevermind... it's just not executed... don't know why... but like that it's not helping Quote Link to comment Share on other sites More sharing options...
Dad72 Posted October 2, 2015 Share Posted October 2, 2015 iiceman good solution. I did not know that we could use the Jquery in the playground Quote Link to comment Share on other sites More sharing options...
Ahiru Posted October 2, 2015 Author Share Posted October 2, 2015 Did not know, too - but still does not work http://www.babylonjs-playground.com/#1YGCVH#8 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted July 11, 2017 Share Posted July 11, 2017 // script importation var url = "url.js"; var s = document.createElement("script"); s.src = url; document.head.appendChild(s); just realized i dug this up from the past... I bet this has been covered seince then, but just because this came up from google I figured it would be good to have a solution posted. 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.