# Use noise to move particles back and forth in one axis

## Recommended Posts

Hello,

Please see the attached video (created in Cinema 4D) for what I am trying to achieve in Houdini.

I'm brand new to Houdini and am trying to move particles in one axis, that smoothly swing back-and-forth.

I don't mind using VEX to do this. I've been playing with P.z and v.z * rand(@id), and can move each particle in a random direction along Z, but I can't get the back-and-forth swinging motion.

Thanks.

particles_random_movement_in_one_axis.mp4

##### Share on other sites

OK, I've made some progress. I used a POP VOP to drive force instead of position or velocity, and it worked (thanks to Jeff Wagner's comment here). I also used a POP Soft Limit to recover any stray particles shooting off. Scene file attached here. If I'm doing anything grotesquely wrong (or even mildly wrong), please do chime in and let me know how I could improve it.

Particles One-Axis Test.hipnc

##### Share on other sites

If you want back and forth motion, have you tried use sin/cos? You can use them to get a back and forth motion.

##### Share on other sites

Or if you don't need to do a simulation, don't do a simulation.

##### Share on other sites

Thank you both. Matt, that was what I originally wanted, but I do want to later simulate them. I'm still taking baby steps into Houdini's way of doing things, so I'll probably be back with related questions.  Thanks again.

##### Share on other sites

Here is a slight variation to Matt's wrangle solution using the full definition for curl noise, extracted from an attributevop using the View VEX Code menu option.

```#include <voplib.h>

vector freq = set(1,1,1);
vector offset = set (0,0,0);
vector surface_normal = set(0,0,0);
float amp = 1.0;
float roughness = 0.5;
int turb = 3;
float atten = 1.0;
float step_size = 0.0001;
vector vop_noise = vop_curlNoiseVV(@P+@Time, freq, offset, surface_normal, "pnoise", "", turb, 0, amp, roughness, atten, 1, 1, step_size);
@P.z += vop_noise.z; ```

This gives you access to many more noise parameters that you may be used to manipulating, like frequency, amplitude, etc...

Edited by Atom

## Create an account

Register a new account