Collision events sometime not fired

Hi,

I have an issue, very similar to this one : Collision callbacks occasionally not firing

Sometimes the ‘collisionstart’ event is not fired.

This is very random as it can never happen, and suddenly happen 10 times in a row…

From what I understand this may be an issue with Ammo.js rather than Playcanvas, but maybe someone have a workaround?


I have a created an example here : https://playcanv.as/p/oJRzQdgY/

A blue ball is falling, and turns to red when it hits the white box.
You’ll see that sometime the ball stays blue.

The collision script is very simple:

var Collision = pc.createScript('collision');

Collision.attributes.add('material', {
    type: 'asset',
    assetType: 'material'
});

Collision.prototype.initialize = function() {
    this.entity.collision.on("collisionstart", function(e) {
        console.log("COLLISION!!!!!"); 
        this.entity.findByName("Model").model.meshInstances[0].material = this.material.resource;
    }, this);
};
``