The underlying physics technology is versatile enough to break many things, not only tree trunks. It is just a matter of setting up the assets. For the examples below we will concentrate on tree trunks, though.
The Boolean Destructibles system allows you to cause dynamic physical mesh damage (holes) to an otherwise solid object from gunshots or explosions. This is done without the need to pre-model broken states for the object. It uses a pre-modeled 3D shape that is subtracted (boolean operation) from the original object in real-time in the exact location of bullet impacts.
Because the boolean operations happen in real time, the system dynamically re-triangulates the original model (adding polygons) as necessary in order to maintain the original solid shape with the additional holes or missing pieces. The new interior faces that are added to the object take on the material properties and textures (including UVs) of the boolean (subtractive) shape.
The actual performance impact of the boolean system depends on a combination of the geometric complexity of the breakable object:
- Geometric complexity of the boolean shape.
- The number of breakable objects used in the level.
- The number of successive booleans applied to the breakable object.
- The number of shooters firing at the breakable object simultaneously.
General performance guidelines:
- Keep breakable object very low poly.
- Keep boolean object very low poly.
- Use breakable objects sparingly in levels, for interesting/strategic gameplay situations.
- Create and use Surface Type parameters to limit how often a boolean occurs.
- Create and use Surface Type parameters to limit the maximum number of booleans a single object can take.
- Performance can lag noticeably when multiple shooters are firing rapidly at a single breakable object, causing multiple booleans simultaneously – to avoid this lag, try not to place boolean breakable objects in an area populated with a lot of shooters.
Components of the System
The system involves a combination of various components (art assets, surface material types, physics script parameters) in order to function fully. Creating new destructible surface types and/or boolean shapes will require some engineer intervention.
These are the required components of the system:
Setup in 3dsMax
For the Trunk Material, turn on "physicalize" in the Material Editor in 3dsMax. Set the Parameter for the physics to "default".
- Remove any proxy physics objects from parts you want to be breakable.
- Be sure your procedural breakable mesh is closed and have no gaps.
Create a predefined mesh in an extra cgf file, which is used to "cap" the broken parts.
Please take a look at the files shipped with the CryENGINE SDK, they are located in
Game\Objects\natural\trees\explosion_shape. It is not necessary to build for example splinters, but could be later used to create the particle effects around the breaking part.
Setup in Sandbox
- In the Sandbox material editor, the trunk's material surface type needs to be set to "mat_wood_breakable".
- The SurfaceType defines the particle effect and physics parameters for the breakability.
- The physics.lua defines the predefined mesh that is used to cap the tree trunk. It also defines the "splinters" particle effect which would be used together with the breaking.
The file is located at:
- The SurfaceType.xml defines which particle effect to use during breaking and it also defines various physical properties. In the example below, you could set up different effects for joint break, joint shatter and the destroying.
The file is located at:
- p_draw_helper 1 - To show the proxies.
- p_debug_joints 1 - To check weights.
Shoot at the tree to check if it's breakable.