Raycast and collision filtering

I’m going to create usecases…

2 Likes

Until…

I found two main cases to set group and masks differently:

  • raycast ( “XRAY” feature)
  • overlap triggers

bullet doc says :

Each body is part of a group. It collides with other bodies if their group matches the mask, and vise versa. The following check is performed using the group and mask of the two bodies involved. It depends on the collision filter mode.

doc from two major 3D engines (collision filtering is silghty different):

I’m familiar with these engines and now I see what you are trying to do, but by default collisions are activated for the most groups in these engines.

I was testing raycast and collision in armory 201909 and the raycast only work in ‘group 0’, despites that it’s possible to difer only collision groups.

Ray-cast work for me in all groups and masks, try updating to latest armory(2019.10)

Here I added this in CastPhysicsRayNode.hx - line 19:

override function get(from:Int):Dynamic {
...
...
if(mask==0)for(v in 0...20) mask |= (1 << v);

#if arm_physics... ...

Zero value means the same of selecting all groups, for those who have no need to filter the raycast.

edit: a better way

if(mask==0)mask=1048575;

Magic value already exists :
-1 =all groups…