How do you "separate" or "explode" a 3D mesh in Godot?
I'd like to create an effect similar to 2 death animations that exist in Crash Bandicoot 3.
In one of them, Crash is disintegrated: all the triangle faces get separated and fly apart. A similar triangle separation is seen when he dies from fire, the triangles fall separately.
The second is a simple separation of the legs and torso. One enemy that exists in the 1st stage can cut Crash in half, which will cause the torso to stay in place while the legs walk away.
I'd reccomend doing it in a vertex shader to not destroy performance by either always having that many meshes loaded or creating a lag spike on death (by having to create as many meshes as vertices). This is because Godot is fairly high level, so all of its inherit classes have some overhead, and when used (abused?) to this degree it becomes noticeable.
You'd have to know some vector math to make it customisable, but for the flame one I'd take each vertex move it down x units each timestep, clamped to the floor's height
Edit to include an exploding example I made elsewhere in the post
void vertex(){
VERTEX += NORMAL * (sin(TIME)+1.0) *0.1;
}
Assemble your objects from smaller, independent 3D meshes, which you can control separately after destroying an enemy. That's how I do it in my space shooter game.
I'd use a second mesh/model. Take your primary model, duplicate it, cut and separate the faces with your favorite 3d tool. Create a new animation for the mesh. Rotate, transform and scale the pieces as you see fit. Import the mesh and animation into to Godot. When the player dies, hide the primary character model and replace it with your divided mesh, play the animation.
I'm 99% sure Crash uses a unique mesh and animation for all their death scenes. That's how they turn him into a frog, or angel, or shoes + pile of dust, whatever situation calls for.
What kind of shader would be used for that exploding faces effect?
I know I could get a similar effect with animation, but I want to actually separate 1 object in 2, a full blown dismemberment. One way I saw this being done is by hiding (or scaling to 0.001) the blown off part and spawning a new mesh/object that represents just that piece, but is there another way?