RealDocs

UPrimitiveComponent::AddForce

function Engine Blueprint Since unknown
#include "Components/PrimitiveComponent.h"
Access: public Specifiers: virtual

Description

Applies a continuous force to the physics body each frame it is called. Unlike AddImpulse (instantaneous), AddForce must be called every frame to maintain its effect.

Caveats & Gotchas

  • Must be called every frame (e.g. in Tick) to sustain the force. It does not persist between frames.
  • Has no effect unless physics simulation is enabled.
  • For constant environmental forces (gravity wells, wind), consider using PhysicsConstraintComponents or physics volumes instead of per-frame AddForce calls.

Signature

virtual void AddForce(FVector Force, FName BoneName = NAME_None, bool bAccelChange = false)

Parameters

Name Type Description Default
Force FVector Force vector in world space (kg*cm/s²), applied continuously while called.
BoneName FName Target bone for skeletal meshes. NAME_None targets the root body. NAME_None
bAccelChange bool If true, treats Force as acceleration (mass-independent). If false, applies as a true force (F=ma). false

Return Type

void

Example

Hover thruster applying continuous upward force C++
void AHoverCraft::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	// Apply lift force proportional to how far below target height we are
	float HeightDelta = TargetHoverHeight - GetActorLocation().Z;
	FVector LiftForce = FVector(0.f, 0.f, HeightDelta * LiftStrength);
	MeshComponent->AddForce(LiftForce, NAME_None, true); // bAccelChange=true
}

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.