How can I use canon.js in three.js editor?

by John Domboroczki   Last Updated October 10, 2019 13:13 PM

I would like to add bullet physics to a scene crated by the three.js editor. Where do I need to put the canon.js file in order to be able to access it's functions from the editor scripts?

I downloaded the three.js project and used the downloaded version of the editor.

I tried to declare a CANNON.World() instance in one of my editor scripts, to see if the editor is using the library, but I got an error message.

Here is what I tried beforehand:

I tried to put it in the index.html, from the published zip files. I also tried the app.js, but I figured out when you hit play in the editor it is not getting executed. So I copy pased the canon.js file under the editor/js and editor/js/libs folder, with no luck.

When I hit play I get a black square up in the LHS of the screen and it doesn't even enter play mode.

Please see attached screenshots.

This was my error message, obviously the editor can't see the cannon.js:

VM1178:6 Uncaught ReferenceError: CANNON is not defined
at Mesh.eval (eval at Player.load (app.js:83), <anonymous>:6:17)
at Player.load (app.js:83)
at Player.js:29
at g.execute (signals.min.js:8)
at e.Signal.dispatch (signals.min.js:12)
at UI.Panel.<anonymous> (Menubar.Play.js:23)

Screenshot Screenshot



Related Questions


Updated October 26, 2017 13:13 PM

Updated July 11, 2015 13:05 PM

Updated May 20, 2015 03:05 AM

Updated February 20, 2017 14:13 PM

Updated February 25, 2017 20:13 PM