# Particles along a curve - constraint Z orientation

## Recommended Posts

Hi everyone,

I'm trying to do a school of fish with a particle system that would follow a curve. Basically I'm emitting some particles and they move along a curve with a popcurveforce.

By default the particles orientation seem to go along with the curve but since I'm trying to do a school of fish, I would like my particles Z orientation to always be 0 so the fishes don't swim on the back.

So far I've tried with this expression in a popwrangle : p@orient.z = 0;

The thing is it seems to zero out the orientation of x and y as well.. And I still want the x and y to go along with the curve. I'v tried with a popattract instead of a popcurveforce and I'm still not able to constraint the Z orient..

Maybe it has to do with something else than the @orient attribute since I don't see it in my geometry spreadsheet..? There's something I don't get! (Needless to say that I'm new in Houdini :P)

Thanks a lot!

test_fish_school.hiplc

##### Share on other sites

If it can help anyone, I finally ended up switching strategy. Instead of using a popcurveforce, I went back to my first thought of animating a sphere along a spline and use it as a goal object in a popattract

In order to fix my issue with the z orientation, I kind of overrode the particles orientation with the lookat() function so each particle is now aiming at their goal without disturbing their local z-axis..

Here is what I've put in my popwrangle:

```matrix3 m = lookat(v@force, {0,0,0});
p@orient = quaternion(m);```

I have attached a quicktime if you want to have a look.

Cheers!

Edited by splegare
##### Share on other sites

Looks nice, thanks for the solution. I took a look at your file and could not figure it out.

##### Share on other sites

• 10 months later...

Very good plan。

## 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.

×
×