Help With Line trace math

hello! so I’m working on trying to add line traces that measure things Infront of the camera in an array, when I start the game the rotation of the vector is correct, however I need them to stay in line relative to the camera rotation and direction. the second the camera moves, the rotated line trace goes crazy and dose not stay in line. I’m sure its something to do with the math/my understanding of vectors but I’m not sure exactly what is going wrong. the plan is eventually to have a ton of these line traces that have distance measurements for whatever is in front of the camera in a way that simulates the way an IRL item measures distance.

any help is greatly apricated, thanks!

1 Like

I did a post here, about how to line trace in all directions

https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/14

Yeah, if you want two line traces… one straight ahead from the camera and one that is 10 degrees to the right, the math is way off.

For the first line trace, you need to add the camera position to your forward vector to get the end position. The second part, I’ll just give you a screenshot. I think if you click on it, you’ll get a larger version.

1 Like

Holy Crap! not all hero’s wear capes! thank you so much! this works perfect!