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:
authorMatt Ebb <matt@mke3.net>2008-10-30 12:26:30 +0300
committerMatt Ebb <matt@mke3.net>2008-10-30 12:26:30 +0300
commit5fb8debada3db41d2ff40ee9a30e10ddcf35d35e (patch)
tree1703bbcd2babba4a3394e0ce6904bf0bf8e68123 /source/blender
parent258784ae4b756f1e86c272dbbee8adc1e5c7da51 (diff)
* Added a new, slightly experimental force field type: 'Spin'.
It works similarly to Vortex, but it's a more controllable - it doesn't send the particles off accelerating into space, but keeps them spinning around the Z axis of the force field object. This is safe in the branch, but Jahka if you have any feedback, I'd be curious to hear :)
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/effect.c13
-rw-r--r--source/blender/makesdna/DNA_object_force.h1
-rw-r--r--source/blender/src/buttons_object.c4
3 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 122c6c71a6c..8b38fadafb1 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -421,6 +421,19 @@ void do_physical_effector(Object *ob, float *opco, short type, float force_val,
VecAddf(field,field,mag_vec);
break;
+ case PFIELD_SPIN:
+ Projf(temp, velocity, eff_vel);
+
+ Crossf(mag_vec,eff_vel,vec_to_part);
+
+ Normalize(mag_vec);
+
+ VecMulf(mag_vec,force_val*distance*falloff);
+ VecAddf(mag_vec, mag_vec, temp);
+
+ VecCopyf(velocity, mag_vec);
+
+ break;
case PFIELD_MAGNET:
if(planar)
VecCopyf(temp,eff_vel);
diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h
index 21c5242a703..2b8a86ac67b 100644
--- a/source/blender/makesdna/DNA_object_force.h
+++ b/source/blender/makesdna/DNA_object_force.h
@@ -210,6 +210,7 @@ typedef struct SoftBody {
#define PFIELD_HARMONIC 7
#define PFIELD_CHARGE 8
#define PFIELD_LENNARDJ 9
+#define PFIELD_SPIN 10
/* pd->flag: various settings */
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index a8ce9da8780..763038adaae 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -3409,8 +3409,8 @@ static void object_panel_fields(Object *ob)
sprintf(menustr, "Field Type%%t|None%%x0|Spherical%%x%d|Wind%%x%d|Vortex%%x%d|Curve Guide%%x%d|Magnetic%%x%d|Harmonic%%x%d|Texture%%x%d|Charge%%x%d|Lennard-Jones%%x%d",
PFIELD_FORCE, PFIELD_WIND, PFIELD_VORTEX, PFIELD_GUIDE, PFIELD_MAGNET, PFIELD_HARMONIC, PFIELD_TEXTURE, PFIELD_CHARGE, PFIELD_LENNARDJ);
else
- sprintf(menustr, "Field Type%%t|None%%x0|Spherical%%x%d|Wind%%x%d|Vortex%%x%d|Magnetic%%x%d|Harmonic%%x%d|Texture%%x%d|Charge%%x%d|Lennard-Jones%%x%d",
- PFIELD_FORCE, PFIELD_WIND, PFIELD_VORTEX, PFIELD_MAGNET, PFIELD_HARMONIC, PFIELD_TEXTURE, PFIELD_CHARGE, PFIELD_LENNARDJ);
+ sprintf(menustr, "Field Type%%t|None%%x0|Spherical%%x%d|Wind%%x%d|Vortex%%x%d|Spin%%x%d|Magnetic%%x%d|Harmonic%%x%d|Texture%%x%d|Charge%%x%d|Lennard-Jones%%x%d",
+ PFIELD_FORCE, PFIELD_WIND, PFIELD_VORTEX, PFIELD_SPIN, PFIELD_MAGNET, PFIELD_HARMONIC, PFIELD_TEXTURE, PFIELD_CHARGE, PFIELD_LENNARDJ);
if(pd->forcefield==PFIELD_FORCE) tipstr= "Object center attracts or repels particles (On shared object layers)";
else if(pd->forcefield==PFIELD_WIND) tipstr= "Constant force applied in direction of Object Z axis (On shared object layers)";