MrArgost's Lab - Cone Traces

Cone Traces (v2)

A real cone trace for Unreal Engine. Same pins, same Hit Result and same behaviour as the traces you already use, with a cone as the shape. Blueprint and C++, full source included.

Unreal has line, sphere, box and capsule traces. It does not have a cone, and I kept needing one. Every project ended up with the same hack: a dot product for the angle, a distance check for the range, and a growing pile of special cases around them. That holds together until an enemy is standing half inside your flamethrower and the check waves him through, because his pivot sits outside the cone.

So I wrote a proper one. This is the second version, rewritten from scratch.

⚑ Why not just an angle check

A dot product and a distance check treat every actor as a single point. That is the whole problem.

  • Volumes, not pivots. A crate with one corner in the cone is a hit, and the hit lands on that corner instead of in the middle of the crate.

  • A real Hit Result. Impact point, normal, distance, and the component that was hit. An angle check gives you a yes or a no.

  • Your collision setup. Channels, object types and profiles, the same ones the rest of the project already uses.

  • Proper multi results. One hit per component, sorted from start to finish, blocking hit last.

🎯 What people use it for

  • Vision cones. Crouching behind a crate hides you, leaving a foot out does not.

  • Cone attacks. Breath weapons, shotgun spread, wide melee swings.

  • Detection. Sonar pings, security cameras, search lights, anything that reaches out from a point and spreads.

  • Targeting. Picking whatever the player is aiming at, when a line trace is too fussy and a sphere is too generous.

βœ… What you get

  • 12 Blueprint nodes. Single and multi, by channel, for objects, or by profile.

  • Two ways to shape the same cone. Start, End and Radius if you already have a point to aim at. Direction, Length and Half Angle if you are working from a rotation.

  • Nothing new to learn. Same names, pins and defaults as the engine's own sphere traces.

  • Debug draw. The cone in the viewport with the hits marked on it, for one frame, for a duration, or persistent. The colours are pins, so you can tell two traces apart.

  • Full C++ source. Every node is a static function you can call directly.

  • Nothing to set up. Enable the plugin and the nodes are there, under Collision.

βš™οΈ Running it

Put one on every actor that needs it and run it on tick. There is nothing to tune, no quality setting and no accuracy slider to balance, so you get the same answer on the first cone and on the hundredth.

πŸ” Coming from version 1?

Your graphs keep working. Same node names, same pins, same defaults.

🟒 What this is

A trace shape. You give it a start, a direction and a size, and it hands you the hits inside that cone, in the same form as every other trace in your project.

It is not an AI perception system and it does not decide anything for you. If you want a guard that investigates a noise and forgets about it, this is the part that answers "can he see it", not the rest.

πŸ“¦ Technical details

  • 12 Blueprint nodes, all callable from C++ as well

  • Full C++ source included, no external dependencies, no third party code

  • Documented API, plus notes on how it behaves in edge cases

  • Works out of the box in Blueprint, no setup step

5 Likes