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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.