I am trying to detect If an entity is colliding with another specific entity in my script but I cant figure it out. Does anyone know a way to do this?
Hi.
I’m pretty sure you need to take a look at this link:
https://developer.playcanvas.com/en/tutorials/collision-and-triggers/
In a nutshell, add collision and rigid body components to your entities.
Okay, so, specific entity.
When you add collision component, you can handle some events.
this.entity.collision.on('collisionstart', this.onCollision, this);
So write a function that apply argument. In this argument you can access to entity.
Bullet.prototype.onCollision = function(result) {
var entity = result.other;
if (entity.script && entity.script.Player)
this.entity.destroy();
};