Line trace from player to object, then increment outward in a circle around player?

I’m not very good with circle math, so I’m even having a hard time looking this up.

Basically, I want to do a line trace to some object in the level from the player. Once that’s been established, I’d like it to trace to the left and right of that object at some interval (I assume an angle increase/decrease on both sides) using the distance between the player and object as the radius. Then I’d like to continue the traces in those increments in a circle around the player (parallel to the ground).

I’d appreciate any help in this!

Hi Obsidiaguy.

I’ll assume you already know how trace lines with LineTraceByChannel/Object. With that, to trace a line to left and right of the hit object, you may use GetRightVector() to trace a new line to the right and GetRightVector()*-1 to trace a line to the left side.

The tricky part is the circle, you can use MultiSphereTraceByChannel/Objects and iterate among the array result to catch all objects where the sphere passes through, or, also you can use a SphereCollision component on your blueprint and set its world location where you want to check for actors using GetOverlappingActors()

Hope this help.

Thanks for the reply. I should be more specific.

I’m going to be tracing to the left and right of an object in the level when there’s a blocking component/actor in the way. Basically I want it to iterate a trace outward to the left and right until the trace on both sides no longer hits the obstacle.

Here’s a very artistic and beautiful example I did in Paint. The red lines are traces iterating outward from the object, turning green at the point I want them to stop.

75644-trace.jpg

Figured out how to achieve this with this info:

x = cx + r * cos(a)

y = cy + r * sin(a)

Where r is the radius, cx,cy the origin, and a the angle.

Starting with assigning the “a” angle the FindLookatRotation Yaw between the player and the object.

I then increment one angle and decrement the other every trace loop. You must also convert the angle to radians with the D2R node.