[Bf-blender-cvs] [0a15def] fracture_modifier: partial fix attempt for incorrect rotation issue with dynafrac

Martin Felke noreply at git.blender.org
Tue Oct 11 21:41:18 CEST 2016


Commit: 0a15defd444979b487481a598091e6d6a48f8c46
Author: Martin Felke
Date:   Tue Oct 11 21:40:57 2016 +0200
Branches: fracture_modifier
https://developer.blender.org/rB0a15defd444979b487481a598091e6d6a48f8c46

partial fix attempt for incorrect rotation issue with dynafrac

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

M	source/blender/blenkernel/intern/fracture.c
M	source/blender/modifiers/intern/MOD_fracture.c

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

diff --git a/source/blender/blenkernel/intern/fracture.c b/source/blender/blenkernel/intern/fracture.c
index 504b33a..af342d5 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -2128,7 +2128,7 @@ void BKE_match_vertex_coords(MeshIsland* mi, MeshIsland *par, Object *ob, int fr
 	if (is_parent)
 	{
 		copy_v3_v3(centr, mi->centroid);
-		mul_qt_v3(qrot, centr);
+		//mul_qt_v3(qrot, centr);
 		add_v3_v3(centr, loc);
 	}
 	else
@@ -2144,7 +2144,7 @@ void BKE_match_vertex_coords(MeshIsland* mi, MeshIsland *par, Object *ob, int fr
 		copy_v3_v3(co, mi->vertices_cached[j]->co);
 
 		sub_v3_v3(co, mi->centroid);
-		mul_qt_v3(qrot, co);
+		//mul_qt_v3(qrot, co);
 		add_v3_v3(co, centr);
 
 		copy_v3_v3(mi->vertices_cached[j]->co, co);
@@ -2153,7 +2153,7 @@ void BKE_match_vertex_coords(MeshIsland* mi, MeshIsland *par, Object *ob, int fr
 		mi->vertco[3*j+1] = co[1];
 		mi->vertco[3*j+2] = co[2];
 	}
-
+#if 0
 	{
 		DerivedMesh *dm = mi->physics_mesh;
 		MVert* mv, *mvert = dm->getVertArray(dm);
@@ -2166,6 +2166,7 @@ void BKE_match_vertex_coords(MeshIsland* mi, MeshIsland *par, Object *ob, int fr
 			mul_qt_v3(qrot, mv->co);
 		}
 	}
+#endif
 
 	//init rigidbody properly ?
 	copy_v3_v3(mi->centroid, centr);
diff --git a/source/blender/modifiers/intern/MOD_fracture.c b/source/blender/modifiers/intern/MOD_fracture.c
index fea9abf..03f281f 100644
--- a/source/blender/modifiers/intern/MOD_fracture.c
+++ b/source/blender/modifiers/intern/MOD_fracture.c
@@ -1186,11 +1186,14 @@ static FracPointCloud get_points_global(FractureModifierData *emd, Object *ob, D
 			copy_v3_v3(min, bmin);
 
 			if (s != NULL && s->impact_size[0] > 0.0f && emd->limit_impact) {
-				float size[3], nmin[3], nmax[3], loc[3], tmin[3], tmax[3], rloc[3] = {0,0,0};
+				float size[3], nmin[3], nmax[3], loc[3], tmin[3], tmax[3], rloc[3] = {0,0,0}, quat[4] = {1,0,0,0};
 				MeshIslandSequence *msq = emd->current_mi_entry->prev ? emd->current_mi_entry->prev : emd->current_mi_entry;
 				MeshIsland *mi = NULL;
 				RigidBodyOb *rbo = NULL;
 
+				mat4_to_quat(quat, ob->obmat);
+				invert_qt(quat);
+
 				if (msq) {
 					mi = find_meshisland(&msq->meshIslands, s->parent_id);
 					if (!mi) {
@@ -1209,6 +1212,7 @@ static FracPointCloud get_points_global(FractureModifierData *emd, Object *ob, D
 				copy_v3_v3(loc, s->impact_loc);
 
 				sub_v3_v3(loc, rloc);
+				mul_qt_v3(quat, loc);
 				add_v3_v3(loc, s->centroid);
 
 				copy_v3_v3(tmax, s->max);




More information about the Bf-blender-cvs mailing list