Viewport Line Trace collision with odd camera angles

In this video it shows how the ray being cast from our viewport can sometimes come into contact in a place that doesn’t make sense for our guns emitter.

Do we use a similar collision channel modification to detect things like this? Or is it better to use our viewport for aiming but make a second line trace that is actually casting from the gun?

I solved this by doing a dot product to determine if the hit makes sense, if it didn’t (e.g. hitting behind you) then I did another line trace from the muzzle of the gun straight forwards instead.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms