Announcement

Collapse
No announcement yet.

Physics lambda function not running

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Physics lambda function not running

    In my actor beginPlay function I am trying to execute some collision creation code. However it seems that the content of the lambda function is not being run.
    Placing breakpoints inside they are just never hit and we can't figure out why.
    Is there some setting we are missing? Maybe the PrimitiveComponent is the wrong type for this or not setup right? What are the reasons it would fail to run?

    Code:
        FPhysicsCommand::ExecuteWrite(PrimitiveComponent->GetBodyInstance()->GetPhysicsActorHandle(), [&](const FPhysicsActorHandle& Actor)
            {
                PxRigidActor* P = Actor.SyncActor;
                const PxMaterial& Mat = *GPhysXSDK->createMaterial(0.0f, 0.0f, 0.0f);
                P->createShape(PxSphereGeometry(100.f), Mat);
            });
    Code:
    AUKBaseActor::AUKBaseActor()
    {
        PrimaryActorTick.bCanEverTick = true;
        ProceduralMeshComp = CreateDefaultSubobject<UProceduralMeshComponent>(TEXT("GeneratedMesh"));
        RootComponent = ProceduralMeshComp;
        PrimitiveComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Primitive"));
        PrimitiveComponent->SetSimulatePhysics(true);
    }
Working...
X