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:
authorAlexander Gavrilov <angavrilov@gmail.com>2016-07-22 18:55:37 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2016-08-06 10:11:33 +0300
commit277b1d76ff73c3dfb2150ec06af622962c300618 (patch)
tree7902bae924e17e209569bd40d1202ac4efb82ec9 /source/blender/blenkernel/BKE_particle.h
parentb98830902883401412c79638fe5e2b14219a07b1 (diff)
Fix T26658: particles stopped or bounced by 100% permeability colliders.
There were two issues here. One is that the fix done originally for this bug only checks for colliding with the same face as the single preceeding hit. If the particle hits an edge or vertex of the collider, it in fact hits two or more faces, so the loop ends up cycling between first two of them and reaches the max collision limit. The fix is to disable the collider for the sim step once a permeability roll succeeds, by adding it to a skip list. Skipping just one face causes some particles to bounce at odd angles in case of partial permeability. The second problem was that the collider bounced back a small percentage of particles, and the cause seemed to be that the code was set to flip the velocity if the particle was just past the collider but still within collision distance. Inverting both values causes a half permeable collider to stop particles, so it seems that this if branch shouldn't bounce at all. Test file: {F327322} Reviewers: lukastoenne, brecht Reviewed By: brecht Subscribers: brecht, #physics Maniphest Tasks: T26658 Differential Revision: https://developer.blender.org/D2120
Diffstat (limited to 'source/blender/blenkernel/BKE_particle.h')
-rw-r--r--source/blender/blenkernel/BKE_particle.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index 37831728e6f..b3e3968ca9b 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -63,6 +63,8 @@ struct BVHTreeRay;
struct BVHTreeRayHit;
struct EdgeHash;
+#define PARTICLE_COLLISION_MAX_COLLISIONS 10
+
#define PARTICLE_P ParticleData * pa; int p
#define LOOP_PARTICLES for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++)
#define LOOP_EXISTING_PARTICLES for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) if (!(pa->flag & PARS_UNEXIST))
@@ -205,8 +207,7 @@ typedef struct ParticleCollisionElement {
typedef struct ParticleCollision {
struct Object *current;
struct Object *hit;
- struct Object *prev;
- struct Object *skip;
+ struct Object *skip[PARTICLE_COLLISION_MAX_COLLISIONS+1];
struct Object *emitter;
struct CollisionModifierData *md; // collision modifier for current object;
@@ -218,7 +219,7 @@ typedef struct ParticleCollision {
float original_ray_length; //original length of co2-co1, needed for collision time evaluation
- int prev_index;
+ int skip_count;
ParticleCollisionElement pce;