Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2013-09-27 17:45:47 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-09-27 17:45:47 +0400
commit640fc26c030bc05175a2e6cec0e6fa3634065d4e (patch)
treeaa8f0d297490c44a732454f4071a25efd552919a /source/blender/blenkernel/intern/boids.c
parent9aaeaae7e0cd423c9b5c2edae4419ee2fef4da92 (diff)
Fix #36630, Particlesystem - boids - goal - collision.
Problem was introduced with r54648, which determined the initial interval for the Newton-Raphson method using the "total_time" of the collision - but this info is only defined for regular collisions, not for the raycasting used in boids to find the "ground object". To ensure correct behavior, now clear the collision info before using it (good practice in any case), then check the inv_total_time variable and use the standard 0.001 step if not defined.
Diffstat (limited to 'source/blender/blenkernel/intern/boids.c')
-rw-r--r--source/blender/blenkernel/intern/boids.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index 8ce84609c15..a8d64ea9fb6 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -206,6 +206,8 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
BVHTreeRayHit hit;
float radius = val->personal_space * pa->size, ray_dir[3];
+ memset(&col, 0, sizeof(ParticleCollision));
+
copy_v3_v3(col.co1, pa->prev_state.co);
add_v3_v3v3(col.co2, pa->prev_state.co, pa->prev_state.vel);
sub_v3_v3v3(ray_dir, col.co2, col.co1);
@@ -777,6 +779,8 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float grou
if (!bbd->sim->colliders)
return NULL;
+ memset(&col, 0, sizeof(ParticleCollision));
+
/* first try to find below boid */
copy_v3_v3(col.co1, pa->state.co);
sub_v3_v3v3(col.co2, pa->state.co, zvec);