RealDocs

UGameplayStatics::Blueprint_PredictProjectilePath_Advanced

function Engine Blueprint Since 4.20
#include "Kismet/GameplayStatics.h"
Access: public Specifiers: staticBlueprintCallable

Description

Predicts a projectile arc using a params struct, providing the richest output of the three prediction variants — each path point includes velocity and time in addition to position. Use when you need velocity data along the arc or want to avoid the long parameter list.

Caveats & Gotchas

  • FPredictProjectilePathResult::PathData includes per-step velocity and elapsed time, which the simpler variants omit — if you only need positions, the ByTraceChannel variant allocates less.
  • The params struct must be fully initialized; a default-constructed FPredictProjectilePathParams will produce a zero-velocity simulation that immediately terminates.
  • Tracing uses either ObjectTypes or TraceChannel depending on which field is populated in the params struct — mixing both is unsupported and defaults to ObjectTypes.

Signature

static ENGINE_API bool Blueprint_PredictProjectilePath_Advanced(const UObject* WorldContextObject, const FPredictProjectilePathParams& PredictParams, FPredictProjectilePathResult& PredictResult);

Parameters

Name Type Description Default
WorldContextObject const UObject* Any UObject within the world to provide world context.
PredictParams const FPredictProjectilePathParams& Struct containing all input parameters: start location, velocity, radius, simulation time, trace settings, actors to ignore, and debug options.
PredictResult FPredictProjectilePathResult& Output struct containing the hit result, path data points (each with location, velocity, and time), and the last trace destination.

Return Type

bool

Example

Predict arc with per-step velocity readout C++
FPredictProjectilePathParams Params;
Params.StartLocation = MuzzleLocation;
Params.LaunchVelocity = LaunchVelocity;
Params.bTraceWithCollision = true;
Params.ProjectileRadius = 8.f;
Params.MaxSimTime = 3.f;
Params.SimFrequency = 30.f;
Params.ActorsToIgnore.Add(this);
Params.TraceChannel = ECC_WorldStatic;

FPredictProjectilePathResult Result;
bool bHit = UGameplayStatics::Blueprint_PredictProjectilePath_Advanced(this, Params, Result);

for (const FPredictProjectilePathPointData& Point : Result.PathData)
{
    DrawDebugPoint(GetWorld(), Point.Location, 5.f, FColor::Yellow, false, 1.f);
}

Version History

Introduced in: 4.20

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.