Hi,
I’ve made a simple level generator using Instanced Mesh Components. Everything was working great, but I’ve decided to split the map into smaller chunks. I moved the required components to a new Actor class and spawn a grid of chunks and instantiate meshes in them. After that, the collisions stopped working and the character just drops through it into the abyss. What could be the issue here? The physics and collision settings on the components are exactly the same. All that’s different is that instances are added to actors spawning at runtime instead of one being there from the start. Does that make any difference?
Here’s the chunk’s constructor
AMapChunk::AMapChunk()
{
StaticMeshComponent = CreateDefaultSubobject<UInstancedStaticMeshComponent>(TEXT("FloorMesh"));
StaticMeshComponent->RegisterComponent();
StaticMeshComponent->ReleasePerInstanceRenderData();
StaticMeshComponent->InitPerInstanceRenderData(true);
StaticMeshComponent->SetFlags(RF_Transactional);
AddInstanceComponent(StaticMeshComponent);
RootComponent = StaticMeshComponent;
}
Any ideas? Does the component need the collisions to be initialized manually since it’s spawned and used during beginplay?
UPDATE:
Oddly enough, after switching transform’s mobility in editor DURING runtime the collisions seem to work again. I’m going to look into that…