How does react use the 'cannon.js' physics engine?

Seems 'cannon-es' does not work with Babylon.js?
I get this error when using Cannon-es
(which I do not get when using Cannon)

src/sourceES6/core/Physics/Plugins/cannonJSPlugin.ts:138

TypeError: this.world.add is not a function. (In 'this.world.add(impostor.physicsBody)', 'this.world.add' is undefined)

135 | this.world.addEventListener("preStep", impostor.beforeStep);
136 | this.world.addEventListener("postStep", impostor.afterStep);
137 | impostor.physicsBody.addShape(shape);
> 138 | this.world.add(impostor.physicsBody);
^  139 |
140 | //try to keep the body moving in the right direction by taking old properties.
141 | //Should be tested!

I encourage the team at Babylon.js and Cannon-es to work together, as Cannon has not had a commit in 6 years.

1 Like