Hello,
As I did some mindstorming about writing a small game, I came to the idea, that it would be nice, to give the player
the option just to blow up the walls they want to go through.
My idea was to subdivide the "destructible" models into some randomly generated parts and connect them with breakable joints (JMEPhysics 2). The problem is, that my skills doing so aren't the best, not even my maths (I'm in the 9th grade of the German school, but YES, I know vectors, trigonometry, matrices etc. Thats not the point).
It would be nice if someone could instruct me how to do so.
Best way is to pre model it.
Its not just a case of subdividing meshes as in general walls have no thickness, they are just a shell - imagine an empty cardboard box, if you slice it up its hollow inside - so if you start trying to subdivide them you end up having to create a lot of new geometry to hide the hollowness (new made up word!).
If you pre model various sections of destructable geometry, the hide the moment of destruction behind a big flash, swap in your pre-modeled rubble and let it crumble. . . or something like that
With "pre-model" you mean modelling the subdivision in the graphics editor (like C4D, 3DS MAX etc.)?
The idea is not only that the wall crumbles, but that the parts of the wall even affect the wall/players/etc. behind it, and with a large/complicated map it would be quite impossible to do that in the editor.
As far as I know about loading models in jme those importers convert the formats like .obj into the own .jme format. I think there's the right point to kind of "slice" the model, like you can do in the editor (so it must be somehow possible, even with generating lots of new geometry, that's obviously the same as the editor does with the "Knife-Tool").
It is possible, as you say if you can do it in a modeller then it can be done.
It is however not easy, to do in the first place and positively difficult to do it anywhere near realtime.
I think the premodelling approach would not be a case of premodelling every possible breaking of every single wall.
Instead you might pre model a single wall section broken into pieces. Then when any of your walls need to break you would replace them with a copy of that, and apply forces to the copy depending on what hit it.
For more variety you could model a few different possibilities, for example some broken into smaller fragments for harder impacts.
The thing is that splitting the wall hasn't to be done realtime, it can be done on loading the game, before writing the .jme cache files, so it would have been done only once. The approach of inserting a pre-sliced wall wouldn't do best, because there'll be many different sized walls, and even whole buildings may collapse. I already thought about the idea of slicing pre-modeled parts out of the wall on impact, like inserting them, and removing the parts of the wall with some boolean operation (can you do this in jme?), but the problem is, that it probably would be even slover when there's a large amount of rockets hitting the wall, causing the parts to destroy the wall behind etc, and the ceiling would not fall, even when the force applied on it would be too high.
An idea would be to remove the wall and add those pre-modeled parts instead to match the original shape of the wall, just like you would do on some part of the wall on impact of something fast. But then it would be very difficult (at least for me) to make the parts really match the wall's shape.