Most people on this board suggest splitting up buildings in smaller parts for performance reasons. For example lightmass resolutions which of course will rely on each segment instead of having to share one UV-map for one entire mesh etc.
So I made a house, and imported each segment as a single mesh (outer walls, roof, inner walls, doors etc). Then I put it together inside a blueprint. And it looks fine. The problem is when I enable physics on each mesh. Each segment of the house is colliding with each other which caused some really stupid effects.
For example, each floor is a simple 6-sided block that cuts through the building. Which kind of screws up the collision between the floor and the walls. It’s like the physics enginge doesn’t know how to compute segments when they’re entangled. The result is sort of like a self explosion when I start the game. Each segment of the house is trying to break free.
It took me a while to figure out why the building would instantly “explode” and fall apart everytime I hit play. Is there some way to have Unreal to treat multiple static meshes inside a blueprint as one solid object?
You could constraint all the pieces together probably with a constraint component - Physics Constraint Component User Guide | Unreal Engine Documentation - but I think that is far from ideal. It will be a lot of annoying tedious work and at the end of the day you need to run way too many physics calculations on all of these different staticmesh components.
It would be better to have no physics on any of the meshes, and instead place them inside some kind of parent component that does has physics. The meshes would then simply be attached to the parent that is moving around due to physics. That is way more optimized.
Even better CPU wise would be if you wouldn’t actually use different mesh components, but just model it as one big house.
If a house is suppose to explode with pieces flying everywhere, that I’d solve by changing the collision channels so pieces never have collision to each other, and then upon exploding you apply such a force to all pieces that no one can see that the pieces actually pass through each other.
Physics bodies repel, this is normal. But you could add meshes w/o physics.
Then at game time iterate through all the meshes (get all actors of class)…
Then tick simulate physics when you need the explosion / physics effects.