I am making a game where you are surviving floods of tanks and instead of them blowing up i was thinking that when you shoot it with a rpg and it explodes (The RPG) that it will make parts fall off and make a hole in the tank a better example is like legos i guess you make a wall of legos with the bricks
[][][][][][]
[][][][][][]
[][][][][][]
[][][][][][]
[][][][][][]
So you shoot your RPG at the wall so some blocks fall off
[][][][][][]
[][]####[][]
[]########[]
[][]####[][]
[][][][][][]
but instead of it being just a wall the whole tank is built like this how would i be able to do this?
Also for a better example roblox is a great example
By far the most common and simple method involves modeling your tanks in multiple pieces. Let each piece receive damage events and potentially respond by detaching or destructing.
Note that in practice, depending on the fidelity, it will probably be essential to combine these pieces into as few meshes and bodies as possible and allow dynamic logical separation at runtime, but don’t worry about that until you get it prototyped.
It may also be necessary to devise a system which ensures that if, for instance, the tank has only X blocks holding two sections together, it can no longer function and/or falls apart, aka simulating tensile strength and other intuitive physical realities.
This implies that each piece knows what it is and how it relates to its neighbors and to the “tank” entity as a whole. This is not a simple request, which is why you rarely witness this feature in games. Or when you do, it’s a simplified example where the whole entity has attachments that can break off. What you are describing is significantly more complicated.
A much easier, simpler way to do this would involve one essential “tank” object with many pieces of armor or surface attachments. That way, the individual pieces don’t need to know how they relate to one another. This is many, many orders of magnitude more approachable.