Navigation
API > API/Runtime > API/Runtime/Engine > API/Runtime/Engine/UGameplayStatics
Description
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.
| Name | Blueprint_PredictProjectilePath_ByObjectType |
| Type | function |
| Header File | /Engine/Source/Runtime/Engine/Classes/Kismet/GameplayStatics.h |
| Include Path | #include "Kismet/GameplayStatics.h" |
| Source | /Engine/Source/Runtime/Engine/Private/GameplayStatics.cpp |
UFUNCTION (BlueprintCallable, Category="Game", DisplayName="Predict Projectile Path By ObjectType",
Meta=(WorldContext="WorldContextObject", AutoCreateRefTerm="ActorsToIgnore", AdvancedDisplay="DrawDebugTime, DrawDebugType, SimFrequency, MaxSimTime, OverrideGravityZ", bTracePath=true))
static bool Blueprint_PredictProjectilePath_ByObjectType
(
const UObject * WorldContextObject,
FHitResult & OutHit,
TArray < FVector > & OutPathPositions,
FVector & OutLastTraceDestination,
FVector StartPos,
FVector LaunchVelocity,
bool bTracePath,
float ProjectileRadius,
const TArray < TEnumAsByte < EObjectTypeQuery > > & ObjectTypes,
bool bTraceComplex,
const TArray < AActor * > & ActorsToIgnore,
EDrawDebugTrace::Type DrawDebugType,
float DrawDebugTime,
float SimFrequency,
float MaxSimTime,
float OverrideGravityZ
)
True if hit something along the path if tracing for collision.
Parameters
| Name | Remarks |
|---|---|
| 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 |
| ObjectTypes | ObjectTypes 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) |