UGameplayStatics::Blueprint_PredictProjectilePath_ByTraceChannel

Predict the arc of a virtual projectile affected by gravity with collision checks along the arc.

Windows
MacOS
Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Kismet/GameplayStatics.h

Include

#include "Kismet/GameplayStatics.h"

Source

/Engine/Source/Runtime/Engine/Private/GameplayStatics.cpp

Syntax

static bool Blueprint_PredictProjectilePath_ByTraceChannel
(
    const UObject * WorldContextObject,
    FHitResult & OutHit,
    TArray < FVector > & OutPathPositions,
    FVector & OutLastTraceDestination,
    FVector StartPos,
    FVector LaunchVelocity,
    bool bTracePath,
    float ProjectileRadius,
    TEnumAsByte < ECollisionChannel > TraceChannel,
    bool bTraceComplex,
    const TArray < AActor * > & ActorsToIgnore,
    EDrawDebugTrace::Type DrawDebugType,
    float DrawDebugTime,
    float SimFrequency,
    float MaxSimTime,
    float OverrideGravityZ
)

Remarks

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).

Returns

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

Parameters

Parameter

Description

OutPathPositions

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

OutHit

Predicted hit result, if the projectile will hit something

OutLastTraceDestination

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

StartPos

First start trace location

LaunchVelocity

Velocity the "virtual projectile" is launched at

bTracePath

Trace along the entire path to look for blocking hits

ProjectileRadius

Radius of the virtual projectile to sweep against the environment

TraceChannel

TraceChannel to trace against, if bTracePath is true.

bTraceComplex

Use TraceComplex (trace against triangles not primitives)

ActorsToIgnore

Actors to exclude from the traces

DrawDebugType

Debug type (one-frame, duration, persistent)

DrawDebugTime

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

SimFrequency

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

MaxSimTime

Maximum simulation time for the virtual projectile.

OverrideGravityZ

Optional override of Gravity (if 0, uses WorldGravityZ)

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback