AActor::DisableComponentsSimulatePhysics
#include "GameFramework/Actor.h"
Access: public
Description
Calls SetSimulatePhysics(false) on every primitive component owned by this actor, stopping all physics simulation in one call.
Caveats & Gotchas
- • This only disables simulation — it does not reset linear or angular velocity. Components will freeze at their current positions unless velocity is zeroed separately.
- • Components that are welded to a parent body will re-enable simulation if the weld is broken later; disabling simulation does not sever welds.
- • On networked actors the physics state change is local only by default. Replicate the result (e.g. via AttachToComponent or a replicated property) if clients need to match the server.
Signature
void DisableComponentsSimulatePhysics() Return Type
void Example
Stop all physics on an actor when it lands C++
void AMyActor::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor,
UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
DisableComponentsSimulatePhysics();
// Optionally zero velocity
if (UPrimitiveComponent* Root = Cast<UPrimitiveComponent>(GetRootComponent()))
{
Root->SetPhysicsLinearVelocity(FVector::ZeroVector);
}
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?