diff options
author | Janne Karhu <jhkarh@gmail.com> | 2010-11-03 00:16:41 +0300 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2010-11-03 00:16:41 +0300 |
commit | 09435ec149b499fabb112114bcdd24a9b3dc6cda (patch) | |
tree | 78ca1268596d49c56479a77de91785cc834ee660 /source/blender/blenkernel/intern/boids.c | |
parent | 130088300bec57aa0f11042bb09e48a67417a514 (diff) |
Oops, particle collisions didn't take simulation subframes into account at all.
* This caused nearly all particles to leak through the collision surface if simulation subframes were used and the collision object was moving.
* In addition to fixing this I also did some more cleanup of the collision code and refined some of the comments.
Diffstat (limited to 'source/blender/blenkernel/intern/boids.c')
-rw-r--r-- | source/blender/blenkernel/intern/boids.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 5c2c0721972..1bde0639055 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -205,7 +205,9 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * add_v3_v3v3(col.co2, pa->prev_state.co, pa->prev_state.vel); sub_v3_v3v3(ray_dir, col.co2, col.co1); mul_v3_fl(ray_dir, acbr->look_ahead); - col.t = 0.0f; + col.f = 0.0f; + col.cfra = fmod(bbd->cfra-bbd->dfra, 1.0f); + col.dfra = bbd->dfra; hit.index = -1; hit.dist = col.ray_len = len_v3(ray_dir); @@ -772,7 +774,9 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float *gro sub_v3_v3v3(col.co2, pa->state.co, zvec); sub_v3_v3(col.co2, zvec); sub_v3_v3v3(ray_dir, col.co2, col.co1); - col.t = 0.0f; + col.f = 0.0f; + col.cfra = fmod(bbd->cfra-bbd->dfra, 1.0f); + col.dfra = bbd->dfra; hit.index = -1; hit.dist = col.ray_len = len_v3(ray_dir); @@ -796,7 +800,9 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float *gro sub_v3_v3v3(col.co2, pa->state.co, zvec); sub_v3_v3(col.co2, zvec); sub_v3_v3v3(ray_dir, col.co2, col.co1); - col.t = 0.0f; + col.f = 0.0f; + col.cfra = fmod(bbd->cfra-bbd->dfra, 1.0f); + col.dfra = bbd->dfra; hit.index = -1; hit.dist = col.ray_len = len_v3(ray_dir); |