Collider.prototype.initialize = function () {
this.entity.collision.on('collisionstart', this.onCollisionStart, this);
//name of 1st object
this.Entity1 = this.app.root.findByName('entity1');
//name of 2nd object
this.Entity2 = this.app.root.findByName('entity2');
};
Collider.prototype.onCollisionStart = function (result) {
//Check to see if Entity1 has hit this object
if (result.other == this.Entity1) {
alert("you hit me!!");
}
};
Does the entity you’ve attached the script to have a rigid body and a collision component, and does it take part in the collision or do it’s children have the rigid body and the collision component and take part in the collision?