diff options
author | Janne Karhu <jhkarh@gmail.com> | 2010-01-03 17:51:34 +0300 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2010-01-03 17:51:34 +0300 |
commit | c6e40798fbbd6996310630198261fec194a2109e (patch) | |
tree | a30e1c7aa1db511b53a442fb34ee172ba72f4811 | |
parent | 24a2c6e9bcf5f25f8a41616d40c90dcd7970c582 (diff) |
Stickness factor for particle collisions, patch submitted by Raul Fernandez Hernandez (farsthary).
-rw-r--r-- | release/scripts/ui/properties_physics_field.py | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 4 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_object_force.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_force.c | 6 |
4 files changed, 12 insertions, 2 deletions
diff --git a/release/scripts/ui/properties_physics_field.py b/release/scripts/ui/properties_physics_field.py index c2f1703a912..90e0912896d 100644 --- a/release/scripts/ui/properties_physics_field.py +++ b/release/scripts/ui/properties_physics_field.py @@ -217,6 +217,7 @@ class PHYSICS_PT_collision(PhysicButtonsPanel): col = split.column() col.label(text="Particle:") col.prop(settings, "permeability", slider=True) + col.prop(settings, "stickness") col.prop(settings, "kill_particles") col.label(text="Particle Damping:") sub = col.column(align=True) diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 767dc8fcf89..27e0c632a81 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -2895,7 +2895,9 @@ static void deflect_particle(ParticleSimulationData *sim, int p, float dfra, flo } else { VECCOPY(pa->state.co, col.co2); - VECCOPY(pa->state.vel, vel); + /* Stickness to surface */ + normalize_v3(nor_vec); + VECADDFAC(pa->state.vel, vel, nor_vec, -pd->pdef_stickness); } } deflections++; diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h index 99b8f400a5e..b3cdd6135e7 100644 --- a/source/blender/makesdna/DNA_object_force.h +++ b/source/blender/makesdna/DNA_object_force.h @@ -87,8 +87,9 @@ typedef struct PartDeflect { float pdef_perm; /* Chance of particle passing through mesh */ float pdef_frict; /* Friction factor for particle deflection */ float pdef_rfrict; /* Random element of friction for deflection */ + float pdef_stickness;/* surface particle stickness */ - float absorption, pad; /* used for forces */ + float absorption; /* used for forces */ /* softbody collisions */ float pdef_sbdamp; /* Damping factor for softbody deflection */ diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index f4ff066f2b4..0eb4f9b9da0 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -810,6 +810,12 @@ static void rna_def_collision(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", PDEFLE_KILL_PART); RNA_def_property_ui_text(prop, "Kill Particles", "Kill collided particles"); RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); + + prop= RNA_def_property(srna, "stickness", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "pdef_stickness"); + RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_ui_text(prop, "Stickness", "Amount of stickness to surface collision"); + RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); /* Soft Body and Cloth Interaction */ |