All collision.on("contact") crashes my game

Hi I’m Making A Boss Fight But Anytime A collision.on event is triggered I get this error

ammo.wasm.wasm?id=44573914&branchId=1cd3d000-a859-4598-a815-efaf3e426002&t=a6819ea71a53e67f1dfe3e42957c2971:0x13efd

   Uncaught RuntimeError: memory access out of bounds
at ammo.wasm.wasm?id=44573914&branchId=1cd3d000-a859-4598-a815-efaf3e426002&t=a6819ea71a53e67f1dfe3e42957c2971:0x13efd
at ammo.wasm.wasm?id=44573914&branchId=1cd3d000-a859-4598-a815-efaf3e426002&t=a6819ea71a53e67f1dfe3e42957c2971:0x4a807
at ammo.wasm.wasm?id=44573914&branchId=1cd3d000-a859-4598-a815-efaf3e426002&t=a6819ea71a53e67f1dfe3e42957c2971:0x241d2
at ammo.wasm.wasm?id=44573914&branchId=1cd3d000-a859-4598-a815-efaf3e426002&t=a6819ea71a53e67f1dfe3e42957c2971:0x48ee7
at ammo.wasm.wasm?id=44573914&branchId=1cd3d000-a859-4598-a815-efaf3e426002&t=a6819ea71a53e67f1dfe3e42957c2971:0x48f15
at ammo.wasm.wasm?id=44573914&branchId=1cd3d000-a859-4598-a815-efaf3e426002&t=a6819ea71a53e67f1dfe3e42957c2971:0x3981
at ammo.wasm.wasm?id=44573914&branchId=1cd3d000-a859-4598-a815-efaf3e426002&t=a6819ea71a53e67f1dfe3e42957c2971:0x6eb03
at x.getGravity (ammo.wasm.js?id=44573913&branchId=1cd3d000-a859-4598-a815-efaf3e426002&t=6b7ab3989e4f9f17c86e44380f9181c6:505:444)
at i.onUpdate (playcanvas.min.js?version=1.54.1:6:1160088)
at e.fire (playcanvas.min.js?version=1.54.1:6:11491)

Here’s my editor link
As well as a link to the relevant code

Hi @WilliamBoersma31,

How do I reproduce this? I ran the game and was able to pickup that sphere, didn’t get any error.

1 Like

After collecting the sphere shoot the target on with the wall (With space) And Then Go Shoot The Boss

I was able to get the error to occur with some doing. I can see a loop repeating in the debugger and then a crash. After that the loop repeats again. Are you in a loop somewhere that never returns. There is a lot of code here so can you eliminate maybe the collision in the other room or selectively turn off a module at a time and repeat the actions to narrow down when this occurs?

I also see that the boss has an empty script. When looking at the Boss model I see that you have included a script module but it is blank.

image

shoot.js:
Shoot.prototype.initialize = function() {
NewBul.script.bulletLocal.initializ(this.SpawnPointE);
NewBulC.script.bulletLocal.initializ(this.SpawnPointE);

I also found that there are at least two places where initialize is missing the ‘e’

That Was Actually Purposeful As I Wanted To Only Trigger It On my Command

I’ve Done Some Experiments And It Seems To Be A Engine Issue With Contacts On Compound Collisions

I see you fixed the crash at the end when firing on the Boss

Yes I ended up just making a single collision