I want a switch that is activated by shooting.
The switch is on a lower side-def texture on the side of a small box that sticks up from the ground.
If I fire a projectile (plasma etc) at it, it works as I want: if the projectile hits the box, the switch activates; if I fire too high and the projectile passes over the box, the switch does not activate. Perfect.
The problem comes when the player uses a hitscan weapon instead. Hitscan attacks activate switches even if they don't actually hit the line. Simply crossing it is enough. It's always been that way. e.g. if you stand and fire your pistol through the shootable door at the start of Doom2 Map18, you can hear the switch clicking with every shot.
However, it's not what I want in this case. Actually hitting the box is important.
What's the best way to get what I am trying to achieve?
Prevent hitscans triggering impact lines when passing through.
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
-
-
- Posts: 26871
- Joined: Tue Jul 15, 2003 4:58 pm
- Location: Scotland
-
- Posts: 769
- Joined: Tue Jul 15, 2003 3:37 pm
Re: Prevent hitscans triggering impact lines when passing through.
Not sure if there's a better way, but you could make the switch line damageable, create an ZScript event handler, override its "WorldLineDamaged" method, which knows where the line was hit, and do the positional check yourself.