# Randomizing with Copy/Stamp

## Recommended Posts

Hello all,

I'm rather new to Houdini and this has left me scratching my head.

My goal is to have a bunch of spheres moving up and down, as if they were bobbing on water.

I've created a field of spheres by scattering some points onto a grid and then linking a sphere into a Copy Sop. I then stamped a variable called "bobbing" with this expression: rand(\$PT)*sin(\$F*10)/3. This makes some of my spheres move more than the others.

My issue is that I can't manage to stop them from all starting this motion together and the sine curve kicks in for every one at the same time giving me the effect of a sound speaker playing. How do I get them to retain their current up-down animation while offsetting the start time?

I've tried a ForEach SOP and also a Timeshift SOP but none of them worked and I'm stumped.

I'd be grateful if you could offer any suggestions.

I've attached the .hip file.

bouncingBalls.hipnc

##### Share on other sites

You should add a point number dependent element to the phase of the sine. At its simplest, rand(\$PT)*sin(\$F*10 + \$PT)/3

##### Share on other sites

You should add a point number dependent element to the phase of the sine. At its simplest, rand(\$PT)*sin(\$F*10 + \$PT)/3

thank you very much eetu. I had a gut feeling it was something simple that eluded me. I did as you said and additionally multiplied it by a factor of 10 like so : rand(\$PT)*sin(\$F*10+\$PT*10)/3. this creates the bouncing ball effect that i was looking for. much appreciated

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×