Cone Shaped Trace?

Is it possible to make a cone shaped trace? I’m using 4.5

Hello,
I found only this answerhub thread with a way to do it : https://answers.unrealengine.com/questions/127128/cone-checkcone-trace.html

I can’t get a trace to rotate with the object its coming from. How can I set the rotation direction of the trace.

I came up with something that works for a cone trace option if anybody its lookin for a solution. I used a cone brush, shaped it, and then made it a static mesh. Then added the mesh to my actor BP, placed it, attached it to actor mesh, and set the material of the cone to something invisible. You set collision to overlap everything for the cone, and you can get a overlap node for the cone in the graph. You can’t get hit results, but its similar to a trace, and it will find anything it overlaps. Its working my situation and may work for yours. Cheers! !

Vector math, you need it to develop games.

it is just some vector math that you even do not need to program.
get some blueprint component that has same forward vector as your general direction tracing vector.
make vector that points N*15deg to the right
rotate this vector 30 deg around looking or general direction vector
you have start and end location for trace
do full circle

repeat above for next value of N

or if cone can be pyramid not really circular cone:
start location is your camera ow whatever you want trace from
then for end location you have 2 loops one iterates rows other columns every 10 or so untis
then either trace in local coordinates to actor.
or get those values, rotate them so they match world rotation, then add world location of begin trace spot.

There is also multiline trace, or sphere trace (just trace along looking vector and increase sphere radius to match size of cone).

@DJ-INSERT, I think you can extend your own idea and procedurally create enough trigger shape to cover the cone shape so you get more precise hit location.(imagine that you are going to put ceramic tiles on a cone shaped base)
You can generate components on the fly and then binds the overlap begin/end events as well.
A cone is not a trivial shape, so most physics engine don’t support cone shaped collision, they make it approximated with pyramid shapes to speed up hit detection.
(imagine that the base as a pie, you slice it, and every piece have it’s own weird shaped pyramid that are all triangle, when you slice enough pieces, you get really good approximation of a cone.)

             I think Nawrot's idea is also worth trying as traces are actually quite cheap.

I know this thread is incredibly old, but it shows up as one of the top results on Google for this topic so I figured I’d throw in how I handled this. I didn’t want to do any kind of complex collision since I wanted this to be as efficient as possible so I do this as a 2 pass collision phase. In the first pass, I create a box whose extents are half of the cone’s length, so basically a bounding box on the cone. Then for each hit, I calculate the angle between the cone’s forward vector and the actor hit. If it’s less than or equal to half the cone’s radius, then it’s inside the cone, otherwise it’s outside. There are many other threads for how to calculate the angle between two vectors so I won’t waste time with that, but this is another easy and (relatively) inexpensive solution to solve cone collision.

Keep in mind thought that the 2nd pass does use more expensive operations like vector normalization and trig functions but it should only be an issue if you have a massive density of objects, but if that’s the case this function will be the least of your problems.

1 Like

Probably cheaper to do this by doing the box trace, then use Get Dot Product To node on hit actors. Take the result of that, check it with greater than, and feed the resulting bool into a branch.