CANNON is not defined

Referencing this thread

@sebavan quoted: you need CANNON defined on the window, so either you place it in your html from a cdn or you need before creating the plugin something alongside:
window.CANNON = require(‘cannon’)

“window.CANNON = require(‘cannon’);”, if this goes at the top of the js file using the plugin, do i need to install cannon outside of the CannonJSPlugin used in the @BABYLON/core? the original?

Yes. OKay maybe it should have been obvious but I guess I thought cannon as a library was included in @Babylon/core. So basically, make sure cannon is installed and in whatever react file uses cannonjsplugin, also add the line with other imports:

window.CANNON = require(‘cannon’);

1 Like