Хрупкие объекты

Материал из CryWiki Russia

(Различия между версиями)
Перейти к: навигация, поиск
м
Строка 1: Строка 1:
-
<p><span class="fck_mw_template">{{В_процессе_перевода}}</span>
+
{{В_процессе_перевода}}
-
</p>
+
 
-
<h2> Хрупкие объекты </h2>
+
== Хрупкие объекты ==
-
<p>Хрупкие объекты содержат отдельные части соединённые в одной модели сочленениями.<br />Каждая часть может быть отделена физической силой (пулями, взаимодействием с игроком, взрывами) превосходящей ограничения сочленения.<br />В основном, хрупкие объекты размещаются в Sandbox как браши (кисти).<br />Наилучшим примером хрупких объектов являются дорожные знаки или деревянные заборы.
+
 
-
</p>
+
Хрупкие объекты содержат отдельные части соединённые в одной модели сочленениями.
-
<h3> Файл-пример<br /> </h3>
+
Каждая часть может быть отделена физической силой (пулями, взаимодействием с игроком, взрывами) превосходящей ограничения сочленения.
-
<p>Файл-пример: <a href="http://wiki.crymod.com/images/5/5b/Breakable_example.max">Breakable-Example</a>
+
В основном, хрупкие объекты размещаются в Sandbox как браши (кисти).
-
</p>
+
Наилучшим примером хрупких объектов являются дорожные знаки или деревянные заборы.
-
<h3> Основные настройки в 3D-приложении<br /> </h3>
+
 
-
<ul><li>Объекты должны иметь несколько узлов и каждый должен иметь свою собственную физику.
+
=== Файл-пример ===
-
</li><li>Узлы соединены сочленениями (каждое сочленение может быть соединено с 2 частями).
+
Файл-пример: [[Media:Breakable example.rar|Хрупкие объекты]]
-
</li><li>Порядок наименования сочленений: <b>$joint01</b>, <b>$joint02</b>, и т.д.
+
 
-
</li><li>Сочленения в 3D-приложении представляют собой вспомогательные объекты (дамми, пустышки). Они должны пересекать физическую прокси одного или максимум двух геометрических объектов.
+
=== Основные настройки в 3D-приложении ===
-
</li><li>Z-ориентация точки опоры сочленения должна быть направлена наверха (см. раздел «Отладка»).
+
 
-
</li><li>Помимо этого, можно явно указать название части в названии сочленения используя такой формат: <b>$joint1_part1_part2</b>. <span id="result_box" lang="ru"><span class="hps">Это полезно</span> <span class="hps">в</span> <span class="hps">сложных</span> <span class="hps">узлах, где</span> <span class="hps">геометрия</span> <span class="hps">перескает</span><span class="hps"></span> <span class="hps">более чем</span> две <span class="hps">части.</span></span>
+
* Объекты должны иметь несколько узлов и каждый должен иметь свою собственную физику.
-
</li><li>Когда сочленение объекта пересекает только один узел, создаёт сочленение между объектом и миром.
+
* Узлы соединены сочленениями (каждое сочленение может быть соединено с 2 частями).
-
</li><li>Размер дамми-объекта <b>никак не влияет</b> на силу воздействия.
+
* Порядок наименования сочленений: '''$joint01''', '''$joint02''', и т. д.
-
</li><li>Это, однако, используется при повторном приклеплении сочленений к хрупким частями, если некая геометрия также имеет процедурные разрушения (а именно: когда часть процедурно разрушена, все сочленения, которые прикреплены к ней, проверяются на пересечение с вновь образованными частями, и повторно прикрепляет к ним, если это необходимо).
+
* Сочленения в 3D-приложении представляют собой вспомогательные объекты (дамми, пустышки). Они должны пересекать физическую прокси одного или максимум двух геометрических объектов.
-
</li><li>Сила и масса сочленения отдельно определяются в свойствах узла (в каждом 3D-приложении называются по-разному; в 3ds Max: <b>Objects Properties</b> <b>[<i>Свойства объекта</i>]</b>).
+
* Z-ориентация точки опоры сочленения должна быть направлена наверх (см. раздел «Отладка»).
-
</li><li>Определённые ограничения сочленения относятся к нормалям сочленения, представленным вспомогательным узлов оси Z. For joints that specify part names explicitly, care must be taken that the normal points into the 1st parts (otherwise push and pull limits will switch meanings)
+
* Помимо этого, можно явно указать название части в названии сочленения используя такой формат: '''$joint1_part1_part2'''. Это полезно в сложных узлах, где геометрия пересекает более чем две части.
-
</li><li>При экспорте отключите «Merge All Nodes»
+
* Когда сочленение объекта пересекает только один узел, создаёт сочленение между объектом и миром.
-
</li><li>Объекты размещаются как браши или геометрические сущности (Brush\geom. Entity)
+
* Размер дамми-объекта '''никак не влияет''' на силу воздействия.
-
</li></ul>
+
* Это, однако, используется при повторном приклеплении сочленений к хрупким частями, если некая геометрия также имеет процедурные разрушения (а именно: когда часть процедурно разрушена, все сочленения, которые прикреплены к ней, проверяются на пересечение с вновь образованными частями, и повторно прикрепляет к ним, если это необходимо).
-
<ul><li>пример размещения пустышки(Dummy
+
* Сила и масса сочленения отдельно определяются в свойствах узла (в каждом 3D-приложении называются по-разному; в 3ds Max: '''Objects Properties''' '''[''Свойства объекта'']''').
-
</li></ul>
+
* Определённые ограничения сочленения относятся к нормалям сочленения, представленным вспомогательным узлов оси Z. For joints that specify part names explicitly, care must be taken that the normal points into the 1st parts (otherwise push and pull limits will switch meanings).
-
<p><br /><img src="/images/7/7f/PrebrokenObject_dummyplacement.jpg" _fck_mw_filename="PrebrokenObject dummyplacement.jpg" alt="RTENOTITLE" />
+
* При экспорте отключите «Merge All Nodes».
-
</p>
+
* Объекты размещаются как браши или геометрические сущности ('''Brush'''\'''GeomEntity''').
-
<ul><li>пример свойств сочленения (joint)  
+
 
-
</li></ul>
+
* пример размещения пустышки (Dummy):
-
<p><br /><img src="/images/8/85/PrebrokenObject_objectproperties.jpg" _fck_mw_filename="PrebrokenObject objectproperties.jpg" alt="RTENOTITLE" />
+
[[Файл:PrebrokenObject_dummyplacement.jpg]]
-
</p><p>Каждый раз, когда внешние силы (коллизия других объектов или попадание пули) воздействуют на объект, система просчитывает внутренние силы, удерживающие части объекта вместе, и если какие-то силы превышают этот порог, то соответствующие сочленения удаляются. Затем связанные части через удаление сочленений заново рассчитанные и изолированные переносятся к новой сущности.
+
 
-
</p>
+
* пример свойств сочленения (joint):
-
<h4> Свойства узлов(Node) </h4>
+
[[Файл:PrebrokenObject_objectproperties.jpg]]
-
<p>Узлам необходимы свойства присоединения (зависят от программного обеспечения) для корректной работы в движке.
+
 
-
</p>
+
Каждый раз, когда внешние силы (коллизия других объектов или попадание пули) воздействуют на объект, система просчитывает внутренние силы, удерживающие части объекта вместе, и если какие-то силы превышают этот порог, то соответствующие сочленения удаляются. Затем связанные части через удаление сочленений заново рассчитанные и изолированные переносятся к новой сущности.
-
<ul><li>сущность (render geometry property)
+
 
-
</li></ul>
+
==== Свойства узлов(Node) ====
-
<p>Если настройки рендера геометрии включают в себя «entity», то объект не исчезнет после отсоединения от главного объекта.
+
 
-
</p>
+
Узлам необходимы свойства присоединения (зависят от программного обеспечения) для корректной работы в движке.
-
<ul><li>куб (render geometry property)
+
 
-
</li></ul>
+
* сущность (render geometry property)
-
<p>Если настройки рендера геометрии включают в себя «box», то движок будет использовать упрощенный куб (основанный на ограничивающем кубе физического прокси объекта) как коллизию геометрии. Это помогает увеличить скорость просчета физики.
+
 
-
</p><p><br />
+
Если настройки рендера геометрии включают в себя «entity», то объект не исчезнет после отсоединения от главного объекта.
-
</p>
+
 
-
<ul><li>mass=VALUE (render geometry property)
+
* куб (render geometry property)
-
</li></ul>
+
 
-
<p>Mass defines the weight of an object based on real world physics mass=0 sets the object to «unmovable». This is used on the basement of a house for example or the sign pole which should not be movable and always stay in the original position. When used in brushes and Geom Entities, this is the final part’s mass. When used in regular Entities, all parts masses are scaled so that their total mass gives the mass specified in the entity properties.
+
Если настройки рендера геометрии включают в себя «box», то движок будет использовать упрощенный куб (основанный на ограничивающем кубе физического прокси объекта) как коллизию геометрии. Это помогает увеличить скорость просчета физики.
-
</p>
+
 
-
<ul><li>CAUTION* You must either define this value or density to ensure the simulation is working correctly.
+
 
-
</li></ul>
+
 
-
<ul><li>density=VALUE
+
* mass=VALUE (render geometry property)
-
</li></ul>
+
 
-
<p>The engine automatically calculates the mass for an object based on the density and the bounding box of an object. Can be used alternatively to mass.
+
Mass defines the weight of an object based on real world physics mass=0 sets the object to «unmovable». This is used on the basement of a house for example or the sign pole which should not be movable and always stay in the original position. When used in brushes and Geom Entities, this is the final part’s mass. When used in regular Entities, all parts masses are scaled so that their total mass gives the mass specified in the entity properties.
-
</p>
+
 
-
<ul><li>limit=VALUE (Joint object property)
+
* CAUTION* You must either define this value or density to ensure the simulation is working correctly.
-
</li></ul>
+
 
-
<p>limit is a general value for several different kind of forces applied to the joint. It contains a combination of the values below. CAUTION This value needs to be defined, otherwise the simulation will not work correctly. Crysis Example values: 100—500 can be broken by a bullet; 10000 can be broken by the impact of a driving vehicle or a big explosion.
+
* density=VALUE
-
</p><p>The following values are optional and are used to fine tune the «limit» settings.
+
 
-
</p>
+
The engine automatically calculates the mass for an object based on the density and the bounding box of an object. Can be used alternatively to mass.
-
<ul><li>bend=VALUE (Joint object property)
+
 
-
</li></ul>
+
* limit=VALUE (Joint object property)
-
<p>maximum torque around an axis perpendicular to the normal.
+
 
-
</p>
+
limit is a general value for several different kind of forces applied to the joint. It contains a combination of the values below. CAUTION This value needs to be defined, otherwise the simulation will not work correctly. Crysis Example values: 100—500 can be broken by a bullet; 10000 can be broken by the impact of a driving vehicle or a big explosion.
-
<ul><li>twist=VALUE (Joint object property)
+
 
-
</li></ul>
+
The following values are optional and are used to fine tune the «limit» settings.
-
<p>maximum torque around the normal
+
 
-
</p>
+
* bend=VALUE (Joint object property)
-
<ul><li>pull=VALUE (Joint object property)
+
 
-
</li></ul>
+
maximum torque around an axis perpendicular to the normal.
-
<p>maximum force applied to the joint’s 1st object against the joint normal (the parts are «pulled together» as a reaction to external forces pulling them apart)
+
 
-
</p>
+
* twist=VALUE (Joint object property)
-
<ul><li>push=VALUE (Joint object property)
+
 
-
</li></ul>
+
maximum torque around the normal
-
<p>maximum force applied to the joint’s 1st object (i.e. the one whose name is listed first in the joint’s name, or if the names were not specified, the object the joint’s z axis points towards) along the joint normal; joint normal is the joint’s z axis, so for this value to actually be «push apart» (as a reaction to external forces pressing the parts together), this axis must be directed inside the 1st object
+
 
-
</p>
+
* pull=VALUE (Joint object property)
-
<ul><li>shift=VALU (Joint object property)
+
 
-
</li></ul>
+
maximum force applied to the joint’s 1st object against the joint normal (the parts are «pulled together» as a reaction to external forces pulling them apart)
-
<p>maximum force in the direction perpendicular to normal
+
 
-
</p><p>Addition: joints also support non-fully-rigid (non-6dof) constraints. A full rigid constraint will become a dynamic constraint if its either bend and twist limit gets broken and the joint has a non-0 «constrant_limit» property.
+
* push=VALUE (Joint object property)
-
</p><p>Broken «bends» will become «socket» constraints, and «twists» will become hinges. The newly created dynamic constraint will inherit pull and shift limits from the joint. The constraint’s frame will be that of the joint’s helper in max. In order to preserve the meaning of «twisting», however, the axes will be swapped (z of the joint’s helper will become the constraint’s x&nbsp;— since both represent the «twising» axis, x will become y, and y wil become z). Thus, for hinges, z asis of the helper should be directed along the desired hinge direction. For socket’s, z axis should be the axis the attached part «bends around».
+
 
-
</p><p>Here is the list of related properties:
+
maximum force applied to the joint’s 1st object (i.e. the one whose name is listed first in the joint’s name, or if the names were not specified, the object the joint’s z axis points towards) along the joint normal; joint normal is the joint’s z axis, so for this value to actually be «push apart» (as a reaction to external forces pressing the parts together), this axis must be directed inside the 1st object
-
</p>
+
 
-
<ul><li>constraint_limit=VALUE (Joint object property)
+
* shift=VALU (Joint object property)
-
</li></ul>
+
 
-
<p>Force limit for the newly created constraint, is checked when the constraint hits a rotation limit and is being pushed further
+
maximum force in the direction perpendicular to normal
-
</p>
+
 
-
<ul><li>constraint_minang=VALUE (Joint object property)
+
Addition: joints also support non-fully-rigid (non-6dof) constraints. A full rigid constraint will become a dynamic constraint if its either bend and twist limit gets broken and the joint has a non-0 «constrant_limit» property.
-
</li><li>constraint_maxang=VALUE (Joint object property)
+
 
-
</li></ul>
+
Broken «bends» will become «socket» constraints, and «twists» will become hinges. The newly created dynamic constraint will inherit pull and shift limits from the joint. The constraint’s frame will be that of the joint’s helper in max. In order to preserve the meaning of «twisting», however, the axes will be swapped (z of the joint’s helper will become the constraint’s x&nbsp;— since both represent the «twising» axis, x will become y, and y wil become z). Thus, for hinges, z asis of the helper should be directed along the desired hinge direction. For socket’s, z axis should be the axis the attached part «bends around».
-
<p>Rotation limits for the constraint (the interpretation is the same as in standalone constraints). The default is no limits
+
 
-
</p>
+
Here is the list of related properties:
-
<ul><li>constraint_damping=VALUE (Joint object property)
+
 
-
</li></ul>
+
* constraint_limit=VALUE (Joint object property)
-
<p>Angular damping (default 0)
+
 
-
</p>
+
Force limit for the newly created constraint, is checked when the constraint hits a rotation limit and is being pushed further
-
<ul><li>constraint_collides=VALUE (Joint object property)
+
 
-
</li></ul>
+
* constraint_minang=VALUE (Joint object property)
-
<p>Whether the constraint parts will ignore collisions with each other (default 1)
+
* constraint_maxang=VALUE (Joint object property)
-
</p><p>For example, to quickly create an unbreakable hinge constraint, one should put this into the joint’s properties: twist = 0 (the constraint will created at the first activation, regardless of force) constraint_limit = 1E20 (just something big enough) Note that the general «limit = xx» is not required, since we want the limits other than twist to remain unbreakable. Also note that the nodes that have dynamic constraints between them should always be physicalized as entities (not particles).
+
 
-
</p>
+
Rotation limits for the constraint (the interpretation is the same as in standalone constraints). The default is no limits
-
<h4> Dissolving into particlespieces </h4>
+
 
-
<p>Jointed Objects can be set up to break in smaller pieces when being detached from the joint. i.e. a wooden sheet breaks into several planks. The object properties must contain the information about the pieces used. i.e. «pieces=$blah1», «pieces=$rock1». Several objects can share the same name, but it is also possible to set up the pieces with different names, i.e. «pieces=$blah1,$blah2». Pieces need to be linked to the object they should replace later on. NOTE: make sure the names of the objects you want to use as pieces are in lower case only i.e. $debris or $piece1. Debris would not work.
+
* constraint_damping=VALUE (Joint object property)
-
</p><p>WARNING Be aware that the search function in the code also returns nodes with only partially matching strings. If you have problems with pieces spawning out of nowhere or existing nodes being cloned for no reason, look into the name strings and change them to avoid this issue.
+
 
-
</p><p>If you don’t specify anything in the piece properties, they will be spawned as particles, which means they will have no collision and will disappear after a few seconds. If you want the pieces to behave like actual physicalized objects, you have to add «entity» into their properties box.
+
Angular damping (default 0)
-
</p>
+
 
-
<ul><li>Sample setup
+
* constraint_collides=VALUE (Joint object property)
-
</li></ul>
+
 
-
<p><br /><img src="/images/d/dd/PrebrokenObject_pieces.jpg" _fck_mw_filename="PrebrokenObject pieces.jpg" alt="RTENOTITLE" />
+
Whether the constraint parts will ignore collisions with each other (default 1)
-
</p><p>Practical examples of how pieces can be used:
+
 
-
</p><p>— Optimization: If you create a dummy object with a nodraw material (like a simple cube) and spawn it as a piece, the jointed object will simply disappear once the joint breaks&nbsp;— it will be replaced by an invisible object. This can be helpful since the piece that is broken off will not fall down and interact with the remaining pieces, potentially causing problems, and it is also beneficial performance-wise. Once the original object is seperated from its joint, no further physics calculations will be necessary.
+
For example, to quickly create an unbreakable hinge constraint, one should put this into the joint’s properties: twist = 0 (the constraint will created at the first activation, regardless of force) constraint_limit = 1E20 (just something big enough) Примечание that the general «limit = xx» is not required, since we want the limits other than twist to remain unbreakable. Also note that the nodes that have dynamic constraints between them should always be physicalized as entities (not particles).
-
</p><p>— Adding dynamic detail: Pieces replace their original object once this object is «broken off» (seperated from it’s joint), so you can take the original object and cut it up into smaller pieces. An example of this is the huts in crysis, most roof panels have two sub-pieces that spawn once the panel breaks off. This results in more detailed breaking and smaller debris. Don’t forget to add «entity» and a realistic mass to the piece properties, and make sure the piece is physicalized, or else the pieces will fall through the ground and/or disappear after a few seconds. (in case they are only small «fluff» pieces, this might actually be intended)
+
 
-
</p><p>— Adding static detail: You can also spawn small debris pieces, that, instead of falling down, stay where they appear (for example steel cables sticking out of a concrete wall). To do this, you have to add the following lines to the properties of the piece:
+
==== Dissolving into particlespieces ====
-
</p><p>entity mass=0 density=0
+
 
-
</p><p>Entity because you want the object to stay where it is once it is spawned, and because you want it to be physicalized. The object needs to be physicalized (i.e. contain polygons with a physicalized material) in order for this to work. Mass and density need to be 0 to assign the objects infinite mass, which results in the object staying where it spawns and not reacting to force. If it wasn’t 0, it would fall down upon spawning.
+
Jointed Objects can be set up to break in smaller pieces when being detached from the joint. i.e. a wooden sheet breaks into several planks. The object properties must contain the information about the pieces used. i.e. «pieces=$blah1», «pieces=$rock1». Several objects can share the same name, but it is also possible to set up the pieces with different names, i.e. «pieces=$blah1,$blah2». Pieces need to be linked to the object they should replace later on. NOTE: make sure the names of the objects you want to use as pieces are in lower case only i.e. $debris or $piece1. Debris would not work.
-
</p>
+
 
-
<h4> Level of detail settings </h4>
+
WARNING Be aware that the search function in the code also returns nodes with only partially matching strings. If you have problems with pieces spawning out of nowhere or existing nodes being cloned for no reason, look into the name strings and change them to avoid this issue.
-
<p>LodCreation per object can easily be added by naming them $lod1; $lod2, $lod3… and linking them to the relevant subobjects. In order to make differentiation easier, a postfix can be added; i.e. «$lod1_wooden plank»
+
 
-
</p>
+
If you don’t specify anything in the piece properties, they will be spawned as particles, which means they will have no collision and will disappear after a few seconds. If you want the pieces to behave like actual physicalized objects, you have to add «entity» into their properties box.
-
<h4> Occlusion Proxy </h4>
+
 
-
<p>An OcclusionProxy can be added by naming it $occlusion and linking it to the relevant jointed object; like a big sheet of metal on a metal fence or a wooden wall on a hut. Occlusion proxy is allowed to have open edges and need to be as low as possible (something around 2-10 polys).
+
* Sample setup:
-
</p>
+
[[Файл:PrebrokenObject_pieces.jpg]]
-
<h4> Instancing within breakable objects </h4>
+
 
-
<p><a _fcknotitle="true" href="AssetCreation InstancingObjects">AssetCreation InstancingObjects</a> Instancing objects] is used to optimize render time by reducing drawcalls and memory consumption. The engine automatically detects identical geometry elements within the exported objects. There is no special setup needed to take advantage of this feature. UVs and relative point position to the pivot need to be identical in objects in order to qualify them for instancing.
+
Practical examples of how pieces can be used:
-
</p>
+
 
-
<h4> Linking Objects to simplify export </h4>
+
— Optimization: If you create a dummy object with a nodraw material (like a simple cube) and spawn it as a piece, the jointed object will simply disappear once the joint breaks&nbsp;— it will be replaced by an invisible object. This can be helpful since the piece that is broken off will not fall down and interact with the remaining pieces, potentially causing problems, and it is also beneficial performance-wise. Once the original object is seperated from its joint, no further physics calculations will be necessary.
-
<p>Linked objects don’t need to be exported, just the Root node needs to be added to the exporter list. All child nodes will automatically be exported. The name and pivot will be derived from the root joint.
+
 
-
</p>
+
— Adding dynamic detail: Pieces replace their original object once this object is «broken off» (seperated from it’s joint), so you can take the original object and cut it up into smaller pieces. An example of this is the huts in crysis, most roof panels have two sub-pieces that spawn once the panel breaks off. This results in more detailed breaking and smaller debris. Don’t forget to add «entity» and a realistic mass to the piece properties, and make sure the piece is physicalized, or else the pieces will fall through the ground and/or disappear after a few seconds. (in case they are only small «fluff» pieces, this might actually be intended)
-
<ul><li>Example of linking objects and joints for simpler export
+
 
-
</li></ul>
+
— Adding static detail: You can also spawn small debris pieces, that, instead of falling down, stay where they appear (for example steel cables sticking out of a concrete wall). To do this, you have to add the following lines to the properties of the piece:
-
<p><br /><img src="/images/0/07/PrebrokenObject_NamingAndHierarchy.jpg" _fck_mw_filename="PrebrokenObject NamingAndHierarchy.jpg" alt="RTENOTITLE" />
+
 
-
</p>
+
entity mass=0 density=0
-
<h3> Setup in Sandbox </h3>
+
 
-
<p>Add the object as a brush or a Geom. Entity. In case of a brush, the engine will detext automatically that the object is breakable. For multiplayer where breaking objects has a massive impact on the data transfer, breakability is automatically disabled (might change later)
+
Entity because you want the object to stay where it is once it is spawned, and because you want it to be physicalized. The object needs to be physicalized (i.e. contain polygons with a physicalized material) in order for this to work. Mass and density need to be 0 to assign the objects infinite mass, which results in the object staying where it spawns and not reacting to force. If it wasn’t 0, it would fall down upon spawning.
-
</p>
+
 
-
<h3> Debugging </h3>
+
==== Level of detail settings ====
-
<ul><li>p_debug_joints 1 shows the default debug mode for joints (see picture below); p_draw_helpers needs to be activated
+
 
-
</li><li>CAUTION Never scale a joint If you need a new size, create a new joint. the scaling value will be passed on to the engine and causes wrong results in the simulation.
+
LodCreation per object can easily be added by naming them $lod1; $lod2, $lod3… and linking them to the relevant subobjects. In order to make differentiation easier, a postfix can be added; i.e. «$lod1_wooden plank»
-
</li><li>The «spikes» on the joint objects show the orientation. For limits to properly reflect their names (i.e. pull, twist, etc), the spikes must be directed along the «natural» joints axes. However, it’s also possible to keep them always pointing up, for consistency.
+
 
-
</li><li>The blue colored numbers show the mass of the single pieces. Note the «0.00kg» this is the mass of the top node&nbsp;— in this case a dummy.
+
==== Occlusion Proxy ====
-
</li><li>Joints linked to the world are displayed red.
+
 
-
</li><li>When a force is applied to a joint, the direction is shown (in this case shift and bend), together with the strength and the limit of the particular joint. Green text represents an impact with an impulse much lower then the joint limit. Yellow represents values closer to the joint limit. Red represents values which were higher than the limit&nbsp;— in this case the joint is broken.
+
An OcclusionProxy can be added by naming it $occlusion and linking it to the relevant jointed object; like a big sheet of metal on a metal fence or a wooden wall on a hut. Occlusion proxy is allowed to have open edges and need to be as low as possible (something around 2-10 polys).
-
</li><li>NOTE: the debug mode is handy to see how the impulse of weapons react with the breakable object. set the general limit first and then fine tune the specific limits by setting them explicitly for shift, bend…
+
 
-
</li></ul>
+
==== Instancing within breakable objects ====
-
<ul><li>Example of debug display
+
 
-
</li></ul>
+
&lt;a _fcknotitle="true" href="AssetCreation InstancingObjects"&gt;AssetCreation InstancingObjects&lt;/a&gt; Instancing objects] is used to optimize render time by reducing drawcalls and memory consumption. The engine automatically detects identical geometry elements within the exported objects. There is no special setup needed to take advantage of this feature. UVs and relative point position to the pivot need to be identical in objects in order to qualify them for instancing.
-
<p><br /><img src="/images/2/26/PrebrokenObject_sign_example.jpg" _fck_mw_filename="PrebrokenObject sign example.jpg" alt="RTENOTITLE" /><br /><br /> <br />
+
 
-
</p><span class="fck_mw_category" sort="Official:Asset_Creation:Basics">Official:Asset Creation:Basics</span> <br/>
+
==== Linking Objects to simplify export ====
 +
 
 +
Linked objects don’t need to be exported, just the Root node needs to be added to the exporter list. All child nodes will automatically be exported. The name and pivot will be derived from the root joint.
 +
 
 +
* Example of linking objects and joints for simpler export:
 +
[[Файл:PrebrokenObject_NamingAndHierarchy.jpg]]
 +
 
 +
=== Setup in Sandbox ===
 +
 
 +
Add the object as a brush or a Geom. Entity. In case of a brush, the engine will detext automatically that the object is breakable. For multiplayer where breaking objects has a massive impact on the data transfer, breakability is automatically disabled (might change later)
 +
 
 +
=== Debugging ===
 +
 
 +
* p_debug_joints 1 shows the default debug mode for joints (see picture below); p_draw_helpers needs to be activated
 +
* CAUTION Never scale a joint If you need a new size, create a new joint. the scaling value will be passed on to the engine and causes wrong results in the simulation.
 +
* The «spikes» on the joint objects show the orientation. For limits to properly reflect their names (i.e. pull, twist, etc), the spikes must be directed along the «natural» joints axes. However, it’s also possible to keep them always pointing up, for consistency.
 +
* The blue colored numbers show the mass of the single pieces. Примечание the «0.00kg» this is the mass of the top node&nbsp;— in this case a dummy.
 +
* Joints linked to the world are displayed red.
 +
* When a force is applied to a joint, the direction is shown (in this case shift and bend), together with the strength and the limit of the particular joint. Green text represents an impact with an impulse much lower then the joint limit. Yellow represents values closer to the joint limit. Red represents values which were higher than the limit&nbsp;— in this case the joint is broken.
 +
* NOTE: the debug mode is handy to see how the impulse of weapons react with the breakable object. set the general limit first and then fine tune the specific limits by setting them explicitly for shift, bend…
 +
 
 +
* Example of debug display:
 +
[[Файл:PrebrokenObject_sign_example.jpg]]
 +
 
 +
[[Категория:Official:Asset Creation:Basics]]

Версия 18:20, 7 июля 2012

Эта страница страница помечена как находящиеся в процессе перевода.


Содержание

Хрупкие объекты

Хрупкие объекты содержат отдельные части соединённые в одной модели сочленениями. Каждая часть может быть отделена физической силой (пулями, взаимодействием с игроком, взрывами) превосходящей ограничения сочленения. В основном, хрупкие объекты размещаются в Sandbox как браши (кисти). Наилучшим примером хрупких объектов являются дорожные знаки или деревянные заборы.

Файл-пример

Файл-пример: Хрупкие объекты

Основные настройки в 3D-приложении

  • Объекты должны иметь несколько узлов и каждый должен иметь свою собственную физику.
  • Узлы соединены сочленениями (каждое сочленение может быть соединено с 2 частями).
  • Порядок наименования сочленений: $joint01, $joint02, и т. д.
  • Сочленения в 3D-приложении представляют собой вспомогательные объекты (дамми, пустышки). Они должны пересекать физическую прокси одного или максимум двух геометрических объектов.
  • Z-ориентация точки опоры сочленения должна быть направлена наверх (см. раздел «Отладка»).
  • Помимо этого, можно явно указать название части в названии сочленения используя такой формат: $joint1_part1_part2. Это полезно в сложных узлах, где геометрия пересекает более чем две части.
  • Когда сочленение объекта пересекает только один узел, создаёт сочленение между объектом и миром.
  • Размер дамми-объекта никак не влияет на силу воздействия.
  • Это, однако, используется при повторном приклеплении сочленений к хрупким частями, если некая геометрия также имеет процедурные разрушения (а именно: когда часть процедурно разрушена, все сочленения, которые прикреплены к ней, проверяются на пересечение с вновь образованными частями, и повторно прикрепляет к ним, если это необходимо).
  • Сила и масса сочленения отдельно определяются в свойствах узла (в каждом 3D-приложении называются по-разному; в 3ds Max: Objects Properties [Свойства объекта]).
  • Определённые ограничения сочленения относятся к нормалям сочленения, представленным вспомогательным узлов оси Z. For joints that specify part names explicitly, care must be taken that the normal points into the 1st parts (otherwise push and pull limits will switch meanings).
  • При экспорте отключите «Merge All Nodes».
  • Объекты размещаются как браши или геометрические сущности (Brush\GeomEntity).
  • пример размещения пустышки (Dummy):

PrebrokenObject dummyplacement.jpg

  • пример свойств сочленения (joint):

PrebrokenObject objectproperties.jpg

Каждый раз, когда внешние силы (коллизия других объектов или попадание пули) воздействуют на объект, система просчитывает внутренние силы, удерживающие части объекта вместе, и если какие-то силы превышают этот порог, то соответствующие сочленения удаляются. Затем связанные части через удаление сочленений заново рассчитанные и изолированные переносятся к новой сущности.

Свойства узлов(Node)

Узлам необходимы свойства присоединения (зависят от программного обеспечения) для корректной работы в движке.

  • сущность (render geometry property)

Если настройки рендера геометрии включают в себя «entity», то объект не исчезнет после отсоединения от главного объекта.

  • куб (render geometry property)

Если настройки рендера геометрии включают в себя «box», то движок будет использовать упрощенный куб (основанный на ограничивающем кубе физического прокси объекта) как коллизию геометрии. Это помогает увеличить скорость просчета физики.


  • mass=VALUE (render geometry property)

Mass defines the weight of an object based on real world physics mass=0 sets the object to «unmovable». This is used on the basement of a house for example or the sign pole which should not be movable and always stay in the original position. When used in brushes and Geom Entities, this is the final part’s mass. When used in regular Entities, all parts masses are scaled so that their total mass gives the mass specified in the entity properties.

  • CAUTION* You must either define this value or density to ensure the simulation is working correctly.
  • density=VALUE

The engine automatically calculates the mass for an object based on the density and the bounding box of an object. Can be used alternatively to mass.

  • limit=VALUE (Joint object property)

limit is a general value for several different kind of forces applied to the joint. It contains a combination of the values below. CAUTION This value needs to be defined, otherwise the simulation will not work correctly. Crysis Example values: 100—500 can be broken by a bullet; 10000 can be broken by the impact of a driving vehicle or a big explosion.

The following values are optional and are used to fine tune the «limit» settings.

  • bend=VALUE (Joint object property)

maximum torque around an axis perpendicular to the normal.

  • twist=VALUE (Joint object property)

maximum torque around the normal

  • pull=VALUE (Joint object property)

maximum force applied to the joint’s 1st object against the joint normal (the parts are «pulled together» as a reaction to external forces pulling them apart)

  • push=VALUE (Joint object property)

maximum force applied to the joint’s 1st object (i.e. the one whose name is listed first in the joint’s name, or if the names were not specified, the object the joint’s z axis points towards) along the joint normal; joint normal is the joint’s z axis, so for this value to actually be «push apart» (as a reaction to external forces pressing the parts together), this axis must be directed inside the 1st object

  • shift=VALU (Joint object property)

maximum force in the direction perpendicular to normal

Addition: joints also support non-fully-rigid (non-6dof) constraints. A full rigid constraint will become a dynamic constraint if its either bend and twist limit gets broken and the joint has a non-0 «constrant_limit» property.

Broken «bends» will become «socket» constraints, and «twists» will become hinges. The newly created dynamic constraint will inherit pull and shift limits from the joint. The constraint’s frame will be that of the joint’s helper in max. In order to preserve the meaning of «twisting», however, the axes will be swapped (z of the joint’s helper will become the constraint’s x — since both represent the «twising» axis, x will become y, and y wil become z). Thus, for hinges, z asis of the helper should be directed along the desired hinge direction. For socket’s, z axis should be the axis the attached part «bends around».

Here is the list of related properties:

  • constraint_limit=VALUE (Joint object property)

Force limit for the newly created constraint, is checked when the constraint hits a rotation limit and is being pushed further

  • constraint_minang=VALUE (Joint object property)
  • constraint_maxang=VALUE (Joint object property)

Rotation limits for the constraint (the interpretation is the same as in standalone constraints). The default is no limits

  • constraint_damping=VALUE (Joint object property)

Angular damping (default 0)

  • constraint_collides=VALUE (Joint object property)

Whether the constraint parts will ignore collisions with each other (default 1)

For example, to quickly create an unbreakable hinge constraint, one should put this into the joint’s properties: twist = 0 (the constraint will created at the first activation, regardless of force) constraint_limit = 1E20 (just something big enough) Примечание that the general «limit = xx» is not required, since we want the limits other than twist to remain unbreakable. Also note that the nodes that have dynamic constraints between them should always be physicalized as entities (not particles).

Dissolving into particlespieces

Jointed Objects can be set up to break in smaller pieces when being detached from the joint. i.e. a wooden sheet breaks into several planks. The object properties must contain the information about the pieces used. i.e. «pieces=$blah1», «pieces=$rock1». Several objects can share the same name, but it is also possible to set up the pieces with different names, i.e. «pieces=$blah1,$blah2». Pieces need to be linked to the object they should replace later on. NOTE: make sure the names of the objects you want to use as pieces are in lower case only i.e. $debris or $piece1. Debris would not work.

WARNING Be aware that the search function in the code also returns nodes with only partially matching strings. If you have problems with pieces spawning out of nowhere or existing nodes being cloned for no reason, look into the name strings and change them to avoid this issue.

If you don’t specify anything in the piece properties, they will be spawned as particles, which means they will have no collision and will disappear after a few seconds. If you want the pieces to behave like actual physicalized objects, you have to add «entity» into their properties box.

  • Sample setup:

PrebrokenObject pieces.jpg

Practical examples of how pieces can be used:

— Optimization: If you create a dummy object with a nodraw material (like a simple cube) and spawn it as a piece, the jointed object will simply disappear once the joint breaks — it will be replaced by an invisible object. This can be helpful since the piece that is broken off will not fall down and interact with the remaining pieces, potentially causing problems, and it is also beneficial performance-wise. Once the original object is seperated from its joint, no further physics calculations will be necessary.

— Adding dynamic detail: Pieces replace their original object once this object is «broken off» (seperated from it’s joint), so you can take the original object and cut it up into smaller pieces. An example of this is the huts in crysis, most roof panels have two sub-pieces that spawn once the panel breaks off. This results in more detailed breaking and smaller debris. Don’t forget to add «entity» and a realistic mass to the piece properties, and make sure the piece is physicalized, or else the pieces will fall through the ground and/or disappear after a few seconds. (in case they are only small «fluff» pieces, this might actually be intended)

— Adding static detail: You can also spawn small debris pieces, that, instead of falling down, stay where they appear (for example steel cables sticking out of a concrete wall). To do this, you have to add the following lines to the properties of the piece:

entity mass=0 density=0

Entity because you want the object to stay where it is once it is spawned, and because you want it to be physicalized. The object needs to be physicalized (i.e. contain polygons with a physicalized material) in order for this to work. Mass and density need to be 0 to assign the objects infinite mass, which results in the object staying where it spawns and not reacting to force. If it wasn’t 0, it would fall down upon spawning.

Level of detail settings

LodCreation per object can easily be added by naming them $lod1; $lod2, $lod3… and linking them to the relevant subobjects. In order to make differentiation easier, a postfix can be added; i.e. «$lod1_wooden plank»

Occlusion Proxy

An OcclusionProxy can be added by naming it $occlusion and linking it to the relevant jointed object; like a big sheet of metal on a metal fence or a wooden wall on a hut. Occlusion proxy is allowed to have open edges and need to be as low as possible (something around 2-10 polys).

Instancing within breakable objects

<a _fcknotitle="true" href="AssetCreation InstancingObjects">AssetCreation InstancingObjects</a> Instancing objects] is used to optimize render time by reducing drawcalls and memory consumption. The engine automatically detects identical geometry elements within the exported objects. There is no special setup needed to take advantage of this feature. UVs and relative point position to the pivot need to be identical in objects in order to qualify them for instancing.

Linking Objects to simplify export

Linked objects don’t need to be exported, just the Root node needs to be added to the exporter list. All child nodes will automatically be exported. The name and pivot will be derived from the root joint.

  • Example of linking objects and joints for simpler export:

PrebrokenObject NamingAndHierarchy.jpg

Setup in Sandbox

Add the object as a brush or a Geom. Entity. In case of a brush, the engine will detext automatically that the object is breakable. For multiplayer where breaking objects has a massive impact on the data transfer, breakability is automatically disabled (might change later)

Debugging

  • p_debug_joints 1 shows the default debug mode for joints (see picture below); p_draw_helpers needs to be activated
  • CAUTION Never scale a joint If you need a new size, create a new joint. the scaling value will be passed on to the engine and causes wrong results in the simulation.
  • The «spikes» on the joint objects show the orientation. For limits to properly reflect their names (i.e. pull, twist, etc), the spikes must be directed along the «natural» joints axes. However, it’s also possible to keep them always pointing up, for consistency.
  • The blue colored numbers show the mass of the single pieces. Примечание the «0.00kg» this is the mass of the top node — in this case a dummy.
  • Joints linked to the world are displayed red.
  • When a force is applied to a joint, the direction is shown (in this case shift and bend), together with the strength and the limit of the particular joint. Green text represents an impact with an impulse much lower then the joint limit. Yellow represents values closer to the joint limit. Red represents values which were higher than the limit — in this case the joint is broken.
  • NOTE: the debug mode is handy to see how the impulse of weapons react with the breakable object. set the general limit first and then fine tune the specific limits by setting them explicitly for shift, bend…
  • Example of debug display:

PrebrokenObject sign example.jpg