RealDocs

UGameplayStatics::SuggestProjectileVelocity_CustomArc

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

Description

Calculates a launch velocity for a projectile at rest at StartPos to land at EndPos, using an artist-controlled arc parameter rather than a fixed launch speed. Projectile speed is variable — the function solves for whatever speed achieves the desired arc.

Caveats & Gotchas

  • Unlike BlueprintSuggestProjectileVelocity, this function does not trace for obstacles — the result may pass through geometry; combine with a path prediction call if collision checking is needed.
  • ArcParam at exactly 0 produces a straight-up launch (infinite height at zero horizontal velocity), which is undefined behaviour — keep ArcParam above a small epsilon like 0.01.
  • ArcParam at exactly 1 launches directly toward EndPos with no arc; gravity causes the actual impact point to fall short unless the targets are at the same elevation.

Signature

static ENGINE_API bool SuggestProjectileVelocity_CustomArc(const UObject* WorldContextObject, FVector& OutLaunchVelocity, FVector StartPos, FVector EndPos, float OverrideGravityZ = 0, float ArcParam = 0.5f);

Parameters

Name Type Description Default
WorldContextObject const UObject* Any UObject within the world to provide world context.
OutLaunchVelocity FVector& Output: the calculated launch velocity required to reach EndPos.
StartPos FVector Start position of the projectile.
EndPos FVector Desired end position of the projectile.
OverrideGravityZ float Optional override of world gravity Z; 0 uses world gravity. 0
ArcParam float Arc height 0.0-1.0. 0.5 is a medium arc, 0 launches straight up, 1 launches directly toward EndPos. 0.5f

Return Type

bool

Example

Lob a grenade with artist-tuned arc height C++
FVector LaunchVelocity;
if (UGameplayStatics::SuggestProjectileVelocity_CustomArc(
    this, LaunchVelocity,
    GetActorLocation(), TargetLocation,
    0.f, 0.7f))
{
    SpawnGrenade(LaunchVelocity);
}

Version History

Introduced in: 4.15

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.