Invisible to rays?

I have a turret that shoots nice fat green gobs for bullets.
The problem? The script that handles choosing targets requires there to be a direct line of sight between where the turret’s aiming and itself.
When you shoot a bullet, guess what? There’s something between the two!

Is there any way to make the bullets invisible to rays, but still use physics for collisions?

So you want the turret to fire only when an object is in its direct line of sight?

Can’t you perform a raycast between the turret and the target and only have the bullets fire when there’s no object of a specific property in between? You might also need other logic to make sure you get the right object but I can’t see why it wouldn’t work (like a tripwire that works opposite of what one usually does).

You could cast a ray in the direction of the turret, and if it detects one of the bullets, cast again from the bullet’s position (or from there plus some), and repeat until it returns a non-bullet hit, or None.

EDIT: Oops, hah, go with Ace’s suggestion. Just give the target-able objects a property that the bullets don’t have, and use that for the ray checks.

I know that I can use X-ray until I find an object of a particular property, but:
I don’t want every single wall to have to have a property telling it that it’s a wall.
Likewise, giving the X-ray the property of the target will mean it ignores walls.

Also, the ray will never hit the target, because the turret aims ahead.

It sounds like you guys know a way to do the opposite of an X-ray, to cast a ray that looks for anything that isn’t a certain property. I can’t find out how to do that.

It sounds like solar-lunes suggestion is the only one that will work, but I can’t help feeling there must be a better way.

Here’s a diagram, in case it helps:


There used to be a check-box in 2.49 that toggled whether a face used collision or not. Is there the same in 2.6 somewhere?

Try to fir the ray the other direction. Instead from turret to im point scan from aimpoint near turret.

If you hit a bullet or nothing you know there is empty space (in most situations).

I have a continuos ray example samewhere. You might want to look for x-ray mouse.

Try to fir the ray the other direction. Instead from turret to im point scan from aimpoint near turret.

Brilliant. That is just the sort of simple solution I was hoping someone could give me!