no collision on root skeletal mesh component

Hey, have a class where I add a SkeletalMeshComponent as root component. It shows up but has no collision.

  • a physics asset exists for the mesh and it is assigned (verified by opening mesh in content browser)
  • if i drag the mesh into the level collision works as expected

This is the code for assigning the SkeletalMeshComponent as actor RootComponent. It works perfectly for StaticMeshComponents but I must be missing an extra step for SkeletalMeshComponent?



// create new component
T* newMesh = CreateDefaultSubobject<T>(FName(*uniqueName));

// set as root 
RootComponent = newMesh;

// find mesh in content and assign to component
ConstructorHelpers::FObjectFinder<USkeletalMesh> newAsset(ANSI_TO_TCHAR(meshAssetName));
if (newAsset.Succeeded())
{
	((USkeletalMeshComponent*)newMesh)->SetSkeletalMesh(newAsset.Object);
}


Solved it by adding:


((USkeletalMeshComponent*)newMesh)->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);

For hilarity, do this on a skeletal mesh with a physics object that isn’t properly set up for physics


((USkeletalMeshComponent*)newMesh)->SetSimulatePhysics(true);