[Bf-blender-cvs] [2ea86a8] fracture_modifier: fix for dynamic fracture rotation glitch (was wrong calculation)

Martin Felke noreply at git.blender.org
Mon Nov 9 11:06:20 CET 2015


Commit: 2ea86a8817e0db0a707035e7c3fb543699455e60
Author: Martin Felke
Date:   Mon Nov 9 10:59:46 2015 +0100
Branches: fracture_modifier
https://developer.blender.org/rB2ea86a8817e0db0a707035e7c3fb543699455e60

fix for dynamic fracture rotation glitch (was wrong calculation)

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

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

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

diff --git a/source/blender/blenkernel/intern/fracture.c b/source/blender/blenkernel/intern/fracture.c
index 82151fb..644b8a5 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -1905,7 +1905,6 @@ void BKE_match_vertex_coords(MeshIsland* mi, MeshIsland *par, Object *ob, int fr
 	float mat[4][4];
 	float quat[4] = {1.0f, 0.0f, 0.0f, 0.0f};
 	float qrot[4] = {1.0f, 0.0f, 0.0f, 0.0f};
-	float crot[4];
 
 	invert_m4_m4(mat, ob->obmat);
 
@@ -1918,18 +1917,15 @@ void BKE_match_vertex_coords(MeshIsland* mi, MeshIsland *par, Object *ob, int fr
 	mi->rots[2] = rot[2] = par->rots[4*frame+2];
 	mi->rots[3] = rot[3] = par->rots[4*frame+3];
 
-	mi->rots[0] = rot[0] = par->rots[4*frame];
-	mi->rots[1] = rot[1] = par->rots[4*frame+1];
-	mi->rots[2] = rot[2] = par->rots[4*frame+2];
-	mi->rots[3] = rot[3] = par->rots[4*frame+3];
-
 	mul_m4_v3(mat, loc);
 	mat4_to_quat(quat, mat);
 
-	//combine
-	mul_qt_qtqt(qrot, rot, quat);
-	conjugate_qt_qt(crot, rot);
-	mul_qt_qtqt(qrot, qrot, crot);
+
+	if (par->id > 0)
+	{
+		mul_qt_qtqt(qrot, rot, par->rot);
+		mul_qt_qtqt(qrot, quat, qrot);
+	}
 
 	if (is_parent)
 	{
@@ -1975,7 +1971,7 @@ void BKE_match_vertex_coords(MeshIsland* mi, MeshIsland *par, Object *ob, int fr
 
 	//init rigidbody properly ?
 	copy_v3_v3(mi->centroid, centr);
-	copy_qt_qt(mi->rot, rot);
+	copy_qt_qt(mi->rot, qrot);
 }
 
 void BKE_free_constraints(FractureModifierData *fmd)




More information about the Bf-blender-cvs mailing list