Commit: dc526671c760db8c81d2fe5f99626b7a2d3dc7b3
Author: Luca Rood
Date:   Thu Dec 8 19:26:33 2016 -0200
Branches: cloth-improvements
https://developer.blender.org/rBdc526671c760db8c81d2fe5f99626b7a2d3dc7b3

Implement angular bending damping

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

M       release/scripts/startup/bl_ui/properties_physics_cloth.py
M       source/blender/physics/intern/BPH_mass_spring.cpp
M       source/blender/physics/intern/implicit_blender.c

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

diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py 
b/release/scripts/startup/bl_ui/properties_physics_cloth.py
index 43096d5..f57b0e0 100644
--- a/release/scripts/startup/bl_ui/properties_physics_cloth.py
+++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py
@@ -97,6 +97,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel):
         col.prop(cloth, "tension_damping", text="Tension")
         col.prop(cloth, "compression_damping", text="Compression")
         col.prop(cloth, "shear_damping", text="Shear")
+        col.prop(cloth, "bending_damping", text="Bending")
         col.prop(cloth, "air_damping", text="Air")
         col.prop(cloth, "vel_damping", text="Velocity")
 
diff --git a/source/blender/physics/intern/BPH_mass_spring.cpp 
b/source/blender/physics/intern/BPH_mass_spring.cpp
index 36794f1..dbebc6b 100644
--- a/source/blender/physics/intern/BPH_mass_spring.cpp
+++ b/source/blender/physics/intern/BPH_mass_spring.cpp
@@ -453,7 +453,7 @@ BLI_INLINE void cloth_calc_spring_force(ClothModifierData 
*clmd, ClothSpring *s,
                kb = scaling / (20.0f * (parms->avg_spring_len + FLT_EPSILON));
                
                // Fix for [#45084] for cloth stiffness must have cb 
proportional to kb
-               cb = kb * parms->bending_damping;
+               cb = kb * 0.5f; // this was multiplied by a constant 
parms->bending_damping, which is no longer constant
                
                /* XXX assuming same restlen for ij and jk segments here, this 
can be done correctly for hair later */
                BPH_mass_spring_force_spring_bending_hair(data, s->ij, s->kl, 
s->mn, s->target, kb, cb);
diff --git a/source/blender/physics/intern/implicit_blender.c 
b/source/blender/physics/intern/implicit_blender.c
index 6a4eb70..d7b984a 100644
--- a/source/blender/physics/intern/implicit_blender.c
+++ b/source/blender/physics/intern/implicit_blender.c
@@ -1742,8 +1742,12 @@ bool BPH_mass_spring_force_spring_angular(Implicit_Data 
*data, int i, int j, int
        spring_angle(data, i, j, i_a, i_b, len_a, len_b,
                     dir_a, dir_b, &angle, vel_a, vel_b);
 
+       /* spring force */
        force = stiffness * (angle - restang);
 
+       /* damping force */
+       force += -damping * (dot_v3v3(vel_a, dir_a) + dot_v3v3(vel_b, dir_b));
+
        mul_v3_v3fl(f_a, dir_a, force / len_a);
        mul_v3_v3fl(f_b, dir_b, force / len_b);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to