Enable physics on StaticMeshComponent in Throwables

This commit is contained in:
baz 2023-09-12 23:38:35 +01:00
parent 62ac0e7496
commit fe6eca55c5
1 changed files with 4 additions and 1 deletions

View File

@ -12,7 +12,10 @@ AThrowable::AThrowable()
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = false; PrimaryActorTick.bCanEverTick = false;
StaticMeshComponent->SetCollisionProfileName(FName("NoCollision")); StaticMeshComponent->SetCollisionProfileName(FName("PhysicsActor"));
StaticMeshComponent->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
StaticMeshComponent->SetSimulatePhysics(true);
SetRootComponent(StaticMeshComponent);
SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComponent")); SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComponent"));
SphereComponent->SetSphereRadius(25.0f, true); SphereComponent->SetSphereRadius(25.0f, true);