Frankie; OK I’ve given this a try and it looks to be exactly what I want with the exception that I am unable to set “Simulate Physics” on any of the meshes, despite them having Collision Meshes set.
As a test I took one of the meshes and created a Blueprint from it, as I was able to set “Simulate Physics”, so the meshes seem set-up just fine.
The only way I can get physics is by adding a collision object (a box for example) as a separate item in the blueprint, and even then it seem to behave quite right.
Could this be due to how I’m creating the UStaticMeshComponents in the Pawn C++ class, perhaps?
I’m using:
[FONT=Courier New]RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT(“RootComponent”));
BaseMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT(“BaseMesh”));
BaseMesh->AttachTo(RootComponent);
BodyMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT(“BodyMesh”));
BodyMesh->AttachTo(BaseMesh);
HeadMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT(“HeadMesh”));
HeadMesh->AttachTo(BodyMesh);
Edit Further debugging. I added some logging in the BeginPlay() method and it looks like the editor should be able set “Simulate Physics”:
[FONT=Courier New]void AHeroPawn::BeginPlay()
{
Super::BeginPlay();
UE_LOG(LogTemp, Log, TEXT("BaseMesh can simulate physics: %s"), (BaseMesh->CanEditSimulatePhysics() ? TEXT("YES") : TEXT("NO")));
UE_LOG(LogTemp, Log, TEXT("BodyMesh can simulate physics: %s"), (BodyMesh->CanEditSimulatePhysics() ? TEXT("YES") : TEXT("NO")));
UE_LOG(LogTemp, Log, TEXT("HeadMesh can simulate physics: %s"), (HeadMesh->CanEditSimulatePhysics() ? TEXT("YES") : TEXT("NO")));
}
and got this:
[FONT=Courier New]LogTemp: BaseMesh can simulate physics: YES
LogTemp: BodyMesh can simulate physics: YES
LogTemp: HeadMesh can simulate physics: YES
However there is no “Simulate Physics” setting in the Physics section: