Commit: 3523a136d046a7247db341b8588134d479368225
Author: Martin Felke
Date:   Sun Mar 22 18:17:11 2015 +0100
Branches: fracture_modifier
https://developer.blender.org/rB3523a136d046a7247db341b8588134d479368225

use center between objects for constraint types different than fixed, note: 
other types only work between clusters and settings for them are limited to the 
type currently....

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

M       source/blender/blenkernel/intern/rigidbody.c
M       source/blender/editors/object/object_modifier.c

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

diff --git a/source/blender/blenkernel/intern/rigidbody.c 
b/source/blender/blenkernel/intern/rigidbody.c
index 6c0bccd..b296841 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1519,7 +1519,16 @@ void 
BKE_rigidbody_validate_sim_shard_constraint(RigidBodyWorld *rbw, RigidBodyS
                }
 
                /* do this for all constraints */
-               copy_v3_v3(loc, rbc->mi1->rigidbody->pos);
+               /* location for fixed constraints doesnt matter, so keep old 
setting */
+               if (rbc->type == RBC_TYPE_FIXED) {
+                       copy_v3_v3(loc, rbc->mi1->rigidbody->pos);
+               }
+               else {
+                       /* else set location to center */
+                       add_v3_v3v3(loc, rbc->mi1->rigidbody->pos, 
rbc->mi2->rigidbody->pos);
+                       mul_v3_fl(loc, 0.5f);
+               }
+
                copy_v4_v4(rot, rbc->mi1->rigidbody->orn);
 
                if (rb1 && rb2) {
diff --git a/source/blender/editors/object/object_modifier.c 
b/source/blender/editors/object/object_modifier.c
index ad72108..35e2455 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -2754,7 +2754,16 @@ static Object* 
do_convert_constraints(FractureModifierData *fmd, RigidBodyShardC
 
        /*use same settings as in modifier
         *XXX Maybe use the CENTER between objects ? Might be correct for Non 
fixed constraints*/
-       copy_v3_v3(rbcon->loc, ob1->loc);
+       /* location for fixed constraints doesnt matter, so keep old setting */
+       /* keep in sync with rigidbody.c, 
BKE_rigidbody_validate_sim_shard_constraint() */
+       if (con->type == RBC_TYPE_FIXED) {
+               copy_v3_v3(rbcon->loc, ob1->loc);
+       }
+       else {
+               /* else set location to center */
+               add_v3_v3v3(rbcon->loc, ob1->loc, ob2->loc);
+               mul_v3_fl(rbcon->loc, 0.5f);
+       }
 
        /*omit check for existing objects in group, since this seems very slow, 
and should not be necessary in this internal function*/
        do_unchecked_constraint_add(scene, rbcon, con->type, reports, *base);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to