[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60392] trunk/blender/source/blender/ blenkernel/intern: Fix #36630, Particlesystem - boids - goal - collision.

Lukas Toenne lukas.toenne at googlemail.com
Fri Sep 27 15:45:48 CEST 2013


Revision: 60392
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60392
Author:   lukastoenne
Date:     2013-09-27 13:45:47 +0000 (Fri, 27 Sep 2013)
Log Message:
-----------
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.

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54648

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/boids.c
    trunk/blender/source/blender/blenkernel/intern/particle_system.c

Modified: trunk/blender/source/blender/blenkernel/intern/boids.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/boids.c	2013-09-27 11:42:15 UTC (rev 60391)
+++ trunk/blender/source/blender/blenkernel/intern/boids.c	2013-09-27 13:45:47 UTC (rev 60392)
@@ -206,6 +206,8 @@
 		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 @@
 		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);

Modified: trunk/blender/source/blender/blenkernel/intern/particle_system.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle_system.c	2013-09-27 11:42:15 UTC (rev 60391)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c	2013-09-27 13:45:47 UTC (rev 60392)
@@ -3313,9 +3313,14 @@
 
 	pce->inv_nor = -1;
 
-	/* Initial step size should be small, but not too small or floating point
-	 * precision errors will appear. - z0r */
-	dt_init = COLLISION_INIT_STEP * col->inv_total_time;
+	if (col->inv_total_time > 0.0f) {
+		/* Initial step size should be small, but not too small or floating point
+		 * precision errors will appear. - z0r */
+		dt_init = COLLISION_INIT_STEP * col->inv_total_time;
+	}
+	else {
+		dt_init = 0.001f;
+	}
 
 	/* start from the beginning */
 	t0 = 0.f;




More information about the Bf-blender-cvs mailing list