Line Trace Inter Sections


I have two line traces the first one is in the collapsed node as its just the camera to forward vector Trace.
The second is supposed to send a line trace from the Muzzle to where the first line trace hit.
(the third line trace at the bottom is just incase you hit nothing like shooting in the air it goes to the end of the camera line trace)

For some reason the second line trace has a chance not to read as a hit even though the first one hit something. Which results in shooting a target and nothing happens also shooting walls and ground and no special effects because its not actually hitting anything.

What is your distance cutoff for the “out hit trace end” in the collapsed node? Perhaps it’s too short and doesn’t hit a wall / obstacle and has no fallback so the hit doesn’t register.


Unfortunately not the case I can see the first one hit the target pop True on hit and the second one still pops False and the second ones important as that’s the one coming from the muzzle as I don’t want players to be able to shoot what they cant see :frowning: Been struggling with this for about a day now stepped away to just watch videos on cross hairs and line tracing to see if there was an answer and just seems like everyone is content with the bullet coming from the camera not the muzzle

you can see the first one hit but the second doesn’t stops like right before the hit

The thing is with the second trace your end vector is just at the end of the first trace. There will be no interaction / hit. Instead of using the end trace as the stopping point you should use the max distance of the range of the gun (so the vector that plugs into your end node of the collapsed function)

It’s like you are trying to hit someone in the face but stopping milometers just before you touch it.

Or you can use the end trace but extend it just slightly and it will register too.

If you put a debug sphere at the end trace you will see what I mean.

I know what you mean and the issue with that was the gun was no longer accurate


and every time I try to extend it just a little I send it every where except the direction it needs to go

Okay I found a solution from when you said sphere now


Now i make a sphere line and it gives it just that little bit of room to always hit :slight_smile:

I do a line trace to find the crosshair send out a sphere trace to hit the object :slight_smile: thank you! I know that’s not what you meant but still helped by giving me the idea :slight_smile: I appreciate the time spent on this

1 Like

Just watch out that the sphere trace won’t cause fake collisions near things like pillars / columns that may be thin in nature. You don’t want your shots to be blocked by air.

1 Like

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