Topic was automatically imported from the old Question2Answer platform.
Asked By
99week
I made a hitscan weapon, using RayCast. When the player presses the left mouse button, the RayCast checks if an enemy is in it’s way. I want this check to last longer because it only lasts for one very short moment (good for a pistol). I want this check to last longer, so it stays after the click for a few miliseconds more (for a burst rifle).
RayCast (if you’re about a node) “lasts” as long as its enabled property is true.
I haven’t seen your code, but seems like you’re turning it off, right after mouse event is processed.
If so, you need a one-shot Timer to turn it off: Mose event makes both RayCast.enabled = true and Timer.start(), but RayCast.enabled = false should be executed only from Timer’s signal (timeout).