Hi,
Struggling to figure out how to detect a collision between two specific rigid bodies.
My code –
// Creates a new Collider instance
var Collider = function (entity) {
this.entity = entity;
};
Collider.prototype = {
// Called once after all resources are loaded and before the first update
initialize: function () {
this.entity.collision.on('collisionstart', this.onCollisionStart, this);
},
onCollisionStart: function(result){
if(result.other.//entityName){
alert("collision detected");
}
}
};
return Collider;
});```