RealDocs

UActorComponent::DestroyPhysicsState

function Engine Since unknown
#include "Components/ActorComponent.h"
Access: public

Description

Shuts down any physics engine structures for this component by calling OnDestroyPhysicsState. The public entry point used during unregistration, and when physics needs to be rebuilt.

Caveats & Gotchas

  • Safe to call even when no physics state exists (bPhysicsStateCreated == false); it will early-out without any effect.
  • If async physics state creation is currently in progress, this cancels the in-flight job and cleans up the async scene reference before proceeding with synchronous teardown — do not assume the state is fully destroyed until the next game thread tick.

Signature

ENGINE_API void DestroyPhysicsState();

Return Type

void

Example

Rebuild physics state after mesh swap C++
void UMyMeshComponent::SetNewMesh(UStaticMesh* NewMesh)
{
    DestroyPhysicsState();
    StaticMesh = NewMesh;
    MarkRenderStateDirty();
    CreatePhysicsState();
}

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.