RealDocs

UActorComponent::CreatePhysicsState

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

Description

Triggers creation of any physics engine information for this component by calling OnCreatePhysicsState. The public entry point used by the engine during registration and re-registration.

Caveats & Gotchas

  • Only calls through to OnCreatePhysicsState if ShouldCreatePhysicsState() returns true; most base UActorComponent subclasses return false, so you must override ShouldCreatePhysicsState() in your physics-enabled component.
  • Passing bAllowDeferral = true defers creation to a background physics thread when AllowsAsyncPhysicsStateCreation() also returns true; if the physics state was previously deferred but never created, the next call to CreatePhysicsState triggers the deferred GameThread notification.

Signature

ENGINE_API void CreatePhysicsState(bool bAllowDeferral = false);

Parameters

Name Type Description Default
bAllowDeferral bool When true, allows the engine to defer physics state creation to an asynchronous job if the component supports it via AllowsAsyncPhysicsStateCreation(). false

Return Type

void

Example

Forcing physics state creation after a property change C++
void UMyPrimitiveExtension::PostEditChangeProperty(FPropertyChangedEvent& Event)
{
    Super::PostEditChangeProperty(Event);
    if (bPhysicsStateCreated)
    {
        DestroyPhysicsState();
    }
    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.