• News

• Industries

• Learning & Support

• Community

• Marketplace

# Cone trace with proper distance, steps and start/end radius size controls

You will need variables for max distance, start/end radius, a vector, total number of incremental steps you want.

In the first part of the blueprint, you first need to obtain the percentage per step and therefore you divide 1 by the total number of steps. From there, you can calculate how far the trace will travel per step. The rest of of it is pretty standard for a line trace from player. You’re just multiplying the forward vector by the newly modified distance. After you add the two vectors together, right before it goes into the trace end location, you save that position into a vector variable. I saved mine after the trace because of screen clutter.

In the second half of the blueprint, you then go into a loop. It’s important to set the start index to two because you’re already on the second step. You can save the index position into a spare variable to keep wires from being all over, it’s not necessary. This half is very similar to the first half, except you will now be using that saved vector variable for the starting location. You still want to keep using the player’s forward vector. The only other major difference is now you use a map to range clamped node with 0 to 1 for the in spots and start to end radius sizes for the outputs. Due to already being on step two, you won’t have to worry about it multiplying the radius by zero. After the trace is over, you save your vector again for the next cycle through the loop. It will do this X number of times in a row, based on your step resolution.

Needless to say, this could be expanded upon in a number of ways but this is the basic gist of it.

Thanks, exactly what i was looking for.

I just wonder, performance wise, would it be better to have one draw call for a static mesh cone shaped with transparent material, or this ?
(In both cases i’ll need to do one trace from the character to the hit position for various reasons)