Uncaught TypeError: bi is undefined cannon.js:13514:12

I have multiple objects in my scene and I use

i.physicsImpostor.onCollideEvent = async function(brick,t) {
//some actions

everything worked until at one moment there was a simultaneous collision of a box with two bricks.

there was an error
Uncaught TypeError: bi is undefined cannon.js:13514:12

is there a way to avoid this problem?

I created the scene, but I can’t repeat the error

Apparently I’m getting this error because I’m using
mesh.dispose() during collision.

as a temporary solution i used

engine.runRenderLoop(function() {
try {glob_scene.render()}
catch(err) {console.log(err.message)}


I guess a better solution is to dispose one frame after? a very naive approach would be to do something like this:

scene.onBeforeRenderObservable.addOnce(() => {

Hello @kostiunindima1 just checking in, was your question answered?

1 Like