Getting hit face from raycast

Hi! I was wondering if there was any possible way to get which face of an entity was hit by a raycast. I want to make it so that code only executes if the face wasn’t hit directly before the current hit. Let me know if there is any way I can do this, thanks!

Hi @Cryptonaph,

No you can’t get the exact face index hit, what you get is position and normal (face direction).

Maybe you can use the distance from the last hit together with the normal to check if it’s the same face:

1 Like

This thread may help too: Is it possible to get individual sides/faces of a collider

It’s limited to a cuboid or very simple shape though.

1 Like