I didn't try make any destructable object by myself yet, but maybe I can help you.
Quote:How to dynamically construct a destructible object using the code?
I think you can use DestructMesh :
Code:
DestructMesh& create(Mesh &mesh, Int cuts, MaterialPtr material, Flt tex_scale=1, Int phys_vtx_limit=-1, Bool cut_affects_biggest_part=true); // create destructible object from 'mesh', use 'cuts' number of plane cuts to split the mesh, use 'material' for creating the solid inside part with 'tex_scale' texture scaling, 'phys_vtx_limit'=limit for number of vertexes in each physical body part (used only when >0), 'cut_affects_biggest_part'=if apply cutting to the biggest part only or the whole mesh
Next you could for example create own class inherit from Game::Destructable and link destruct data in constructor
Code:
MyDestructClass : GameDestructable
MyDestructClass::MyDestructClass() {
mode =STATIC;
piece_index =-1;
scale = 0;
destruct_mesh= PointerToMyDestructMesh;
}
Quote:In the same way how can i create a destructible objects using the *.destruct file.
add "destruct" Params to Object in Editor with path to destruct file, and use Destructable class to handle it;
Quote:One other thing, is it possible to construct a destructible object using a ragdoll of a character?
As I remember DestructMesh will create destructable parts randomly.
But I belive this is possible, but it will cost you a lot of code to write. (It's not supported by Esenthel Engine, you have to made DestructMesh by yourself, cuts mesh manualy)
Also in "Game Object Classes Source Code" you will find source code for Game::Destructable.