Is it possible to set collision priority?

Godot Version

4.3

Question

There is a 3D character holding a shield in front, and a very fast moving projectile which goes through both the shield and the character in the same frame. The shield and the character have collision check code against the projectile.

I want to make it so whenever the projectile collides both the shield and the character in the same frame, I would like to run the code in the shield collision which will remove the projectile and make it harmless to the character. The code for character collision with the projectile should not run in this case.

Is it possible to do collision priority for this case? godot-4 Programming

could you put the code in here?

Hi @isaisp122 ,

I do not have any code yet, as I was just thinking of how this could be implemented.

Not sure if you can prioritize collisions, but you can probably use something like ray casting at the time the projectile is shot?

u can use $CollisionShape2D.disabled = [bool] to disable collisionshapes. U also can use light mask and visibility layer in the inspector tab of the node if its 2d collisionshape. One is for input layer and the other one is for output layer.