diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-09-17 13:34:39 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-01-20 11:30:01 +0300 |
commit | 0ddea77b1a581b9a7d1fa2993cea127d621bc7fa (patch) | |
tree | 276e87277e5b06a480863f163e2974f4f77a37d5 /source/blender/physics | |
parent | 59d76a406e6cc65017b36a3e830048d7c3b88ff3 (diff) |
Fix for rB71271bb, was replacing the force vectors entirely instead of
adding.
Diffstat (limited to 'source/blender/physics')
-rw-r--r-- | source/blender/physics/intern/implicit_blender.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/physics/intern/implicit_blender.c b/source/blender/physics/intern/implicit_blender.c index 960e88ec246..5f8f6abc535 100644 --- a/source/blender/physics/intern/implicit_blender.c +++ b/source/blender/physics/intern/implicit_blender.c @@ -1451,16 +1451,18 @@ void BPH_mass_spring_force_face_wind(Implicit_Data *data, int v1, int v2, int v3 void BPH_mass_spring_force_edge_wind(Implicit_Data *data, int v1, int v2, const float (*winvec)[3]) { const float effector_scale = 0.01; - float win[3], dir[3], length; + float win[3], dir[3], nor[3], length; sub_v3_v3v3(dir, data->X[v1], data->X[v2]); length = normalize_v3(dir); direction_world_to_root(data, v1, win, winvec[v1]); - madd_v3_v3v3fl(data->F[v1], win, dir, -effector_scale * length * dot_v3v3(win, dir)); + madd_v3_v3v3fl(nor, win, dir, -dot_v3v3(win, dir)); + madd_v3_v3fl(data->F[v1], nor, effector_scale * length); direction_world_to_root(data, v2, win, winvec[v2]); - madd_v3_v3v3fl(data->F[v2], win, dir, -effector_scale * length * dot_v3v3(win, dir)); + madd_v3_v3v3fl(nor, win, dir, -dot_v3v3(win, dir)); + madd_v3_v3fl(data->F[v2], nor, effector_scale * length); } BLI_INLINE void dfdx_spring(float to[3][3], const float dir[3], float length, float L, float k) |