RealDocs

UActorComponent::IsPhysicsStateCreated

function Engine Since 4.0
#include "Components/ActorComponent.h"
Access: public Specifiers: inlineconst

Description

Returns true if the physics state (e.g. PhysX/Chaos rigid body) has been created for this component. Use to guard physics API calls that require an active body.

Caveats & Gotchas

  • Returns false during construction, before the component is registered, and after the physics state has been explicitly destroyed — always check before querying physics body handles.
  • A component can be registered and visible in the world but still have no physics state if collision is disabled or if the component type doesn't create physics bodies (e.g. scene components).
  • The flag is set/cleared on the game thread; do not read it from worker threads without a memory barrier.

Signature

bool IsPhysicsStateCreated() const

Return Type

bool

Example

Guard physics velocity query with state check C++
FVector UMyComponent::GetPhysicsVelocitySafe() const
{
    if (IsPhysicsStateCreated())
    {
        return GetPhysicsLinearVelocity();
    }
    return FVector::ZeroVector;
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.