Predict Projectile Path By TraceChannel

Predict Projectile Path By TraceChannel

Windows
MacOS
Linux

Predict the arc of a virtual projectile affected by gravity with collision checks along the arc. Returns a list of positions of the simulated arc and the destination reached by the simulation. Returns true if it hit something (if tracing with collision).

Target is Gameplay Statics

Predict Projectile Path By TraceChannel
Start Pos
X0
Y 0
Z 0
Launch Velocity
X0
Y 0
Z 0
Trace Path
Projectile Radius
0.0
Trace Channel
ECC_WorldDynamic
Trace Complex
Actors to Ignore
Draw Debug Type
None
Draw Debug Time
0.0
Sim Frequency
15.000000
Max Sim Time
2.000000
Override Gravity Z
0.000000
Out Hit
Out Path Positions
Out Last Trace Destination
X0
Y 0
Z 0
Return Value

Inputs

In
Exec
Start Pos
Vector

First start trace location

Launch Velocity
Vector

Velocity the "virtual projectile" is launched at

Trace Path
Boolean

Trace along the entire path to look for blocking hits

Projectile Radius
Float

Radius of the virtual projectile to sweep against the environment

Trace Channel
ECollisionChannel Enum

TraceChannel to trace against, if bTracePath is true.

Trace Complex
Boolean

Use TraceComplex (trace against triangles not primitives)

Actors to Ignore
Array of Actor Object References

Actors to exclude from the traces

Draw Debug Type
EDrawDebugTrace Enum

Debug type (one-frame, duration, persistent)

Draw Debug Time
Float

Duration of debug lines (only relevant for DrawDebugType::Duration)

Sim Frequency
Float

Determines size of each sub-step in the simulation (chopping up MaxSimTime)

Max Sim Time
Float

Maximum simulation time for the virtual projectile.

Override Gravity Z
Float

Optional override of Gravity (if 0, uses WorldGravityZ)

Outputs

Out
Exec
Out Hit
Hit Result Structure

Predicted hit result, if the projectile will hit something

Out Path Positions
Array of Vectors

Predicted projectile path. Ordered series of positions from StartPos to the end. Includes location at point of impact if it hit something.

Out Last Trace Destination
Vector

Goal position of the final trace it did. Will not be in the path if there is a hit.

Return Value
Boolean

True if hit something along the path (if tracing with collision).

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss