Extensions:2.6/Py/Scripts/Object/Destructability

提供: wiki
< Extensions:2.6‎ | Py‎ | Scripts‎ | Object
移動先: 案内検索
Blender Destructability Editor
Define how dynamic destruction of blender objects is handled by the game engine
UI location Object:Destructability
Version 1.3 Author(s) scorpion81
Blender 2.66 License GPL
Category Object Distribution External


Executable information
File name object_destruction
Current version download https://github.com/scorpion81/Blender-Destructability-Editor/zipball/master ; http://projects.blender.org/tracker/download.php/153/467/30567/19746/object_destruction.zip
External Python Modules or dependencies voronoi.pyd (Windows) / voronoi.cpython32mu.so (Linux) / voronoi.so (OSX) cythoned version of external library voro++, provided with addon, sources provided also


Links https://github.com/scorpion81/Blender-Destructability-Editor/blob/master/object_destruction/README


Installation:

  1. Download zipball from github or from tracker link
  2. Unzip and copy/move folder object_destruction to blender addons or addons_contrib directory
  3. in blender, search under Community or Testing for "Destructability"
  4. when you found the addon (Object->Destructability), activate it there
  5. you should now find a new button Destructability under Physics Panel

UI Description:

Under Physics Tab you find a new Button "Destruction". Pressing it reveals a collection of panels.

Destruction Fracture

  • Boolean Fracture: This option cuts away shards iteratively from the object by intersecting and differencing with an (invisible) cutter object. (Code from pildanovak)
  • Crack Type:
    • Flat: use a cube as cutter, making straight cuts. The fastest method.
    • Flat rough: use a displaced cube, making jaggier cuts (slower)
    • Spherical: use a sphere as cutter, making round cuts (slower)
    • Spherical rough: use a displaced sphere as cutter, making jaggy and round cuts(very slow)
  • Roughness: Strength of the cutter displacement. Higher means jaggier, but can lead to worse performance and unexpected results.
  • Voronoi: Use voronoi cells (pointcloud randomly distributed over whole object, another volume object or particle system) as shards. Works with cubes / simple objects only. You also can use Exact Shape, which uses vertices of the volume object or the original object as pointcloud. Furthermore a limited dissolve is executed, you can set the minimum angle here or 0 for no limited dissolve.
  • Voronoi+Boolean: Use voronoi cells (pointcloud randomly distributed over whole object, another volume object or particle system) as shards. Due to boolean intersection it should work with more complex objects as well. Same options as voronoi, additionally you can remesh the object automatically with the remesh modifier, choose a depth here or 0 for no remeshing.
  • Explosion Modifier: Create new objects from Explosion Modifier shards. You can adjust the thickness and how often the mesh will be subdivided regularly before applying explosion modifier.
  • Blender Cell Fracture: a modified version of regular cell fracture, creating a parent hierarchy.
  • LooseParts: Convert a given object hierarchy to a destructability editor parenting hierarchy so it can be decomposed in the game engine

All methods create such a hierarchy, but from the shards. Here the objects themselves are used. they can be fractured further to create a deeper hierarchy.

  • Parts: How many shards will be generated from the object.
  • Intersect with Grid: Make little cube objects out of the original object prior to apply the fracture method (to each cube then) Grid size determines cube count per direction, so higher counts create more smaller cubes.
  • Inner Material: Select a material here which will be applied to the inner shards of a fractured object.
  • Smart Project UVs: Tries to reduce distortions on uvs of the inner shards. You can also adjust the angle limit of smart project.
  • Show Progress Realtime: Shows the fracturing progress on an object (the changing object itself) by redrawing the window on each frame. Best viewed in wireframe mode.
  • Destroy Object: Apply the given settings and execute the fracture.
  • Save file warning: You have to save once manually before starting the game engine after fracturing and adjusting game engine settings.

Destruction Physics

  • Mass Mode and Mass: You have to set the mass of the whole object here PRIOR to fracturing. Uniform mode will copy this mass to each shard while Volume will calculate the mass for each shard according to the ratio of shard volume to volume of whole object multiplied with object mass.
  • Use Clusters:(Experimental, Unfinished Work) This setting should allow to have more irregularly shaped shards (in the game engine only) by trying to group together Objects from a lower hierarchy level to a higher one. You can set a cluster size based in percent of object size in each direction.
  • Glue Threshold: Determines the relative speed the colliding object must have atleast in order to break this shard off the compound.Can be set individually per Object and be copied to other shards (together with all other settings) via Destruction Setup -> Copy from Active to Selected.
  • Collision Bounds margin: Will be applied to all game engine rigidbodies created from the shards (when selected prior to fracture), but can be manually set as well in the game engine rigidbody settings.

Destruction Hierarchy

Fracturing objects into shards recursively (either manually or via Recursive Shatter) builds up a parenting hierarchy. This can be (dynamically) flattened to one level in the game engine, if not needed or be put on another layer (must be set prior to fracturing), the game engine should always be started from layer 1. Putting the hierarchy on another layer was necessary to fully fracture objects of a lower hierarchy step entirely (so no shard is in the compound any more) Due to some (earlier ?) limitations of the compound system in the game engine you need atleast one object designated as compound parent per shard. By using another layer i was able to circumvent this (i think, tested just simple cases). So if problems arise with hierarchical fracture, use another layer here.

  • Recursive Shatter: Works similar to the settings in Cell Fracture, with the difference that parenting is used here to hold the shards together. Recursion determines the depth of fracture, clamp limits the shards generated, random factor describes the influence of randomness when Random is selected. Those options determine which shards will be fractured with higher priority than others.

Destruction Role

  • Is Connectivity Ground: Tags this object as a hard point for ground connectivity calculation (unconnected shards collapse automatically when unconnected and object is stuck at ground)
  • Available for parent empties only: Calculate Ground Connectivity (under Destruction Physics)
  • Grounds: which ground objects to consider in calculation (only tested with one ground, multiple is experimental/unfinished)
  • Consider this: the ground object, usually a scaled plane, must be scaled in that way it matches e.g. the bottom of the object to be connected. You can verify the "success" of finding the ground in the console ("Found Ground Cell" messages should have appeared after pressing P (and stopping the Game Engine again)
  • Connectivity Grid: Determines the count of the connectivity grid cells in each direction (size is calculated from bbox dividing thru count), which contain the shards and are used to calculate the neighborhood, using more cells is more accurate but slower.
  • Use Gravity Collapse: (Experimental, should allow tilting when buildings collapse) Groups all collapsing/unconnected shards temporarily together. You can set the delay in seconds, after which the compound will be fully destroyed.
  • Destructor: Tags an object as being able to destroy designated target compounds (parent empties P_x_S_xxx must be chosen here) If the destructor is a compound itself, all children can be enabled to be destructors as well. Destructor settings are global, but can be overriden for each target separately. If override is disabled, global settings are always used.
    • Hierarchy Depth: up to which depth targets will be destroyed.
    • Object Death Delay: time in seconds after which an activated object will become inactive again, 0 means no deactivation at all.
    • Min/Max Radius: determines the influence range of the destructor (around the impact point)
    • Speed Modifier: fraction of the relative speed, which will be added to the influence radius (to have larger destruction at higher impact speeds)
    • Acceleration Factor: determines the force with which the hit shards will be accelerated in collision direction.
    • Destruction Delay: delay after destruction calculation is done in a loop, in milliseconds. Shards will be activated after this delay when hit. Setting this to lower values may lead to unexpected behavior and results.
    • Targets: lists the targets, you can delete them here via - button or select multiple objects in viewport and press - as well. Add works analogous: pick objects via selector box and press + button or select multiple objects in viewport first to add them all.
    • Custom Ball: override the default object being shot at the targets when pressing LMB.

Destruction Setup

You can setup a basic scene (will be recreated each time until deselected) here and use the player camera in the game engine (or not) You can also start the game engine via the button here and you can copy shard settings from active to selected ones.

Usage in Blenderplayer

After fracturing and saving and starting the BGE once from blender, each time you restart the BGE then, a blend file "yourblendname_game.blend" will be created which can directly be used in the blenderplayer.


See also:

For support and basic usage videos see the according thread at BlenderArtists.org: http://blenderartists.org/forum/showthread.php?247559-WIP-Blender-Destructability-Editor