Capsule Trace with Rotation parameter?

I was wondering if there is a hidden function that performs a capsule trace with an input parameter for rotation, something in the engine not exposed to blueprints.

I’m building a custom movement system that involves dynamic changes to the orientation of the capsule component in some cases. If it were only a FindFloor function I could always use a sphere trace, but if I’m trying to trace forward that won’t work.

So far, the best alternative has been to set the actor location with sweeps and get the hit result, but this approach is way more costly than tracing.

Rotation is a parameter for box tracing, so it would seem like it ought to be an option for capsule traces as well. Is there anything I can look for to expose or a plugin anyone knows about?

I found this:

I’m unclear if/how it can be exposed to blueprints. Most of the tutorials I’m finding are aimed at writing a custom function and exposing that, not altering existing code. Anyone got a link to an applicable tutorial, maybe?


Create a C++ custom blueprint library; in the header and source files include Kismet System Library, world.h, as well as:

include Runtime\Engine\Private\KismetTraceUtils.cpp
include Runtime\Engine\Private\KismetTraceUtils.h

in the source file. Take the original functions for Capsule Trace, add a parameter for rotation. If specifics are needed, look at the syntax in the Box Trace function.

Two more functions will need to be made to replace the trace debugs. Same idea here, declare and define the original functions, but replace the FQuat::Identity with Orientation.Quaternion(), as we don’t want to use an Identity quat.

This solutions works well, but adding dependencies to “KismetTraceUtils.cpp” causes errors on my end when shipping the project.

So i ended up copying some code from “KismetTraceUtils.cpp” to remove the dependency. In case anyone wants my solution, here it is:

You can use a sphere trace instead and translate the Start and End locations to match the size of your capsule

1 Like

Good idea, helped me get what I needed in BP