penetrating ray?

I was wondering, is it possible to make non-terminating rays (I don’t know what to call it, but rays that pass through objects, or only terminate on objects with a certain property instead of all objects with collision enabled)
This would be very useful for things such as the guns in counter-strike, that can shoot through walls/doors

It might be possible to just spawn an empty where the ray terminates and have that empty cast another ray (that is reduced range) (or just a little past that point to avoid collision with the same face) but that seems a bit too resource intensive for one ray.
Anybody know any alternatives?

oops, time to go to school, I guess I have to cut this post short

Maybe delete the window object and shoot another ray instantly?

um… you can set which objects you want the ray to check for. You just give the object a property name and then put the same property name in the ray sensor where is says property. Is that what you mean? then the ray will only check for that object. The cool thing is you could make a host of objects with the same property name that get detected.

Im not sure, but in 3dgurus python scripts post I think there is a ray like that, maybe. There are a couple ray scripts, or one script used a couple times in different ways.

Cant hurt to look at it. Its in resources.

That doesn’t work since the ray doesn’t penetrate objects.

rays penetrate objects to the depth you set it the length of the ray to. So to shoot through walls just make a longer ray that checks for targets and looks for walls it can shoot through. So if it sees say an enemy behind a wall that you can shoot through then the enemy gets shot. You could write a simple script to do it. You could even use two rays… an enemy ray and a shoot through wall ray… etc etc

If you want to make bullet holes appear on the other side of the wall you’ve shot then that’s a bit complicated and unneccessary… you could spawn in a ray attached to an empty that points backwards at your wall and draws on a bullet hole and then get’s removed. But just shooting enemies through a wall shouldn’t be too hard

No they don’t unless the wall in between doesn’t have collision enabled faces.

Exactly. A ray will stop as soon as it hits an object with collision enabled faces. The ray checks for a property, and IF it hits that property it sends a pulse to the controller. Otherwise it stops dead.

Captain Oblivion: – I tried one thing that works decently, but it’s not too practical. I have one ray shoot out, then when it hits an object, places an empty at that location, which sends out it’s own ray, hitting a wall, placing another empty, ect. It requires python and some logic, and it’s not the best system ever. It would work with something simple, but that’s about it.

You could try it if you want though.

~~Stu

yeah, The empty thing was the only solution I could come up with.