[Bf-blender-cvs] [b148eda] fracture_modifier: dynamic fracture, divide force by mass to get higher probability of secondary fractures

Martin Felke noreply at git.blender.org
Thu Oct 13 23:22:36 CEST 2016


Commit: b148eda5a7c4640c2b31f7c3849b75f281d26f63
Author: Martin Felke
Date:   Thu Oct 13 23:22:28 2016 +0200
Branches: fracture_modifier
https://developer.blender.org/rBb148eda5a7c4640c2b31f7c3849b75f281d26f63

dynamic fracture, divide force by mass to get higher probability of secondary fractures

===================================================================

M	source/blender/blenkernel/intern/rigidbody.c
M	source/blender/makesrna/intern/rna_modifier.c

===================================================================

diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 318d2bb..f7fd268 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -2190,6 +2190,9 @@ static void check_fracture(rbContactPoint* cp, RigidBodyWorld *rbw)
 				int id = rbo->meshisland_index;
 				Shard *s = findShard(fmd1, id);
 				MeshIsland* mi = findMeshIsland(fmd1, id);
+				if (mi->rigidbody->mass > 0) {
+					force = force / mi->rigidbody->mass;
+				}
 
 				//printf("FORCE1:%f\n",force);
 				bool canbreak = (force > fmd1->dynamic_force) || (fmd1->limit_impact && can_break(ob2, ob1, fmd1->limit_impact));
@@ -2239,6 +2242,10 @@ static void check_fracture(rbContactPoint* cp, RigidBodyWorld *rbw)
 				Shard *s = findShard(fmd2, id);
 				MeshIsland* mi = findMeshIsland(fmd2, id);
 
+				if (mi->rigidbody->mass > 0) {
+					force = force / mi->rigidbody->mass;
+				}
+
 				//printf("FORCE2:%f\n",force);
 				bool canbreak = (force > fmd2->dynamic_force) || (fmd2->limit_impact && can_break(ob1, ob2, fmd2->limit_impact));
 
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 207aafb..8ae0b26 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -6403,7 +6403,7 @@ static void rna_def_modifier_fracture(BlenderRNA *brna)
 	RNA_def_property_int_sdna(prop, NULL, "dynamic_percentage");
 	RNA_def_property_range(prop, 0, 100);
 	//RNA_def_property_int_funcs(prop, NULL, "rna_RigidBodyModifier_breaking_percentage_set", NULL);
-	RNA_def_property_ui_text(prop, "Constraint Percentage", "Percentage of broken constraints per island which leads to dynamic fracturing of this island");
+	RNA_def_property_ui_text(prop, "Constraint Percentage", "Percentage of broken constraints per island which allows dynamic fracturing of this island");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");




More information about the Bf-blender-cvs mailing list