Raycast and tags

Hi,
i am shooting rays and want to distinguish results by tags. But that doesn’t seem to work:

 var result = this.app.systems.rigidbody.raycastFirst(from, to);

    // If there was a hit, store the entity
    if (result) {
        var hitEntity = result.entity;
         console.log(hitEntity.name + " hitEntity.tags = " + hitEntity.tags.length);

while the name of the hit entity is correct, hitEntity.tags is always undefined.

well, in my case I could also go by entity name (although I don’t like to have dozens of entities having the same name)

Hi @Marjan,

Check the following example:

https://developer.playcanvas.com/en/tutorials/physics-raycasting-by-tag

1 Like