How to make a raycast ignore geometries like it does with ParticleEmitters?

Something I’ve noticed lately is that a ParticleEmitter technically extends Geometry, so any mesh that it has set should be on the scene graph and detectable as a pile of quads/triangles or so.

However this doesn’t happen, which is very nifty.

I have a need for this sort of behavour for some other meshes (muzzle flashes, sparks, etc.) that are only graphical effects and should be exempt from any actual collision calculation, but need to be attached to collidable nodes for convenience. Now I could make a check with every single raycast I make, so it checks if the geometry hit has some tag, but I don’t want to reinvent the wheel.

So is there some sort of flag or something that makes the collideWith() method ignore a mesh automagically or is this some hardcoded low level exception that can’t be replicated on non-ParticleEmitters?


Since ParticleEmitter extends geometry it can override the collideWith() method to do nothing.

The easiest way is to just ignore geometry you don’t want… actually, that’s usually backwards since you really should only be paying attention to geometry you want, ie: geometry that has mapped to some game object in some way. But yeah, in the case of node hierarchies tagged at the top, I guess you’ll have to ignore some geometry by name or by user data or something.

1 Like

Oh. Right. Then it’s time for a custom extends geometry class, implements hookers, blackjack.

I know it’s not optimal but I think this would still be faster than making a ton of raycasts with different collision groups just to avoid some geometry.

Not sure why you’d do that and not just iterate over the results and skip the ones you aren’t interested in. One ray cast per ray is enough.