Static meshes can be attached to bones/sockets on a skeleton. When this is done, the mesh is not initialized in the same way as when dropped into a level, and does not get the correct collision profile. For an object with NoCollision selected, it will in fact have collision in the editor preview, which allows it to collide with ragdolls for example.
- AStaticMeshActor sets “StaticMeshComponent->bUseDefaultCollision = true;” in the ctor
- FAnimationEditorPreviewScene::AttachObjectToPreviewComponent does not set bUseDefaultCollision and therefore the static mesh’s collision settings are not loaded.
We are fixing this by setting bUseDefaultCollision to true in FAnimationEditorPreviewScene::AttachObjectToPreviewComponent if it is a static mesh
bool FAnimationEditorPreviewScene::AttachObjectToPreviewComponent( UObject* Object, FName AttachTo )
{
...
TSubclassOf<UActorComponent> ComponentClass = FComponentAssetBrokerage::GetPrimaryComponentForAsset(Object->GetClass());
if(SkeletalMeshComponent && *ComponentClass && ComponentClass->IsChildOf(USceneComponent::StaticClass()))
{
...
USceneComponent* SceneComponent = NewObject<USceneComponent>(WorldSettings, ComponentClass, NAME_None, RF_Transactional);
...
//
// FIX - adds setting bUseDefaultCollision
//
if (UStaticMeshComponent* StaticMeshComponent = Cast<UStaticMeshComponent>(SceneComponent))
{
StaticMeshComponent->bUseDefaultCollision = true;
}
[Attachment Removed]