Instanced Static Mesh with Physics

Hello I’m currently working on a sandbox game where i can do all the general stuff like placing blocks. However I implemented a block group where you can stick multiple blocks together. I made the block group especially to have combined physics for all meshes in the group.

As I know from other games I played, I may want to inherit up to 1000^3 blocks in one group.
This may sounds rediculous but will be the upper limit for this.

To come to my problem…
I already implemented ISMC in the block group. but physics only work in the static mesh the ISMC is attached to. So I’m looking for a solution where I have a center of mass for the whole group. If i only had cube meshes i may would stick to another approach where I make use of the Custom Mesh. But since I have more complex meshes this would be unnecessary difficult.

I thought the ISMC will be perfect for this since the physics are the same for all instances. But I have no clue how to do this…

Hope, anyone can help with this.
Its also annoying that there is barely no info about programming with the physics engine…

You might be able to figure it out with the static mesh component but given the requirements you might be better off with a particle system (niagara)? I’m just going to assume some things, you say you are working on a sandbox where you can place blocks (sounds like voxel, Minecraft) but blocks can be grouped and behave as a single physics body. at the point of running physics you are moving those blocks out of their original position, so I assume like chopping a tree, at which their original (voxel) positions are not useful anymore. So I assume that when you run the physics you are not going to further use them for anything and it might just as well be a particle simulation which can run with great performance.

Option B, copypaste a few instances (the block group) over to a new ISMC to run physics on its parent?


I mean something like this!

Can I do something like this with Niagara, with the right inertia and center of mass? The blocks can vary with their mass. I haven’t done much with Niagara yet, but the approach sounds interesting.
i don’t plan to use voxels in this way.
The problem I have with ISMC is that the collision doesn’t work. Currently I have the ISMC nested under an invisible SM. But this is the only object that reacts to collision. I already had the idea to write an own collider component. which is built from several boxes.
But I don’t know how to write the algorithm.

1 Like

This is cool! Like the way you can build cars in lego racers. Now I understand what is going on. I am no Niagara expert but I know you can configure particle physics like gravity and I know that the particles can work with collision:

https://www.youtube.com/watch?v=QncETSkkeD8

It’s worth testing if the particle approach comes with more performance than the static mesh approach first.

  • was just thinking about this old game:

https://youtu.be/cfghKEv6gnk?t=885

I’m sure one of the old lego games (creator / racers / island / medieval) had this “brick explosion” effect where things you built could just fall apart. To me it just make sense to use particles.

How can you enable physics in instanced static meshes?