I’m currently looking into the flocking affector and seem to have bumped into some issues that I can’t solve. I opened up the Notch Flocking Demo from the Samples file and added a Clone to Particles with a 3D fish model to try out. What I’m trying to achieve is a flock of fish to follow the null which works fine but in top down view.
The rotation of the fish particles aren’t right as you can see below, the fishes aren’t moving naturally. They are moving to the left but the model is not facing to the left. Is there a way to make it so that it faces the right direction when moving?
The obstacle plug doesn’t seem to be working? I have plugged a 3D object that spawns when you hold the mouse down so the fishes should avoid it by right. But it does not, is there something I am missing?
Here is the Notch File if needed for reference
FlockTest.dfx (1.4 MB)
Cloners use the Z+ axis as the forward axis and it looks like the model is facing along the X+ axis. If you rotate the fish Heading to 90, this should orient them correctly to adjust for this. Secondly, in the Clone to Particles, setting the Rotation Stiffness to 1 gets the result pretty close.
In regards to the collision, I’d suggest using a Repel node parented to the shark Object node - set the Scale quite low and decrease the Amount too. Playing around a little with these parameters should get the result you’re after.
Thank you for the info, I managed to get what I want with this! One more question after I tried this, using the repel node. It does push the fishes away but it also pushes them upwards and downwards. Making it so that the radius of the repel node unable to reach it and thus look like it’s going under/above the shark. Is there a way to keep the fishes from moving in the y axis?
After repel node affector:
In the Mouse Pointer Array, scaling it isn’t advisable as it can have knock-on effects; Instead, I’d suggest just altering the bounds.
In the Force Affector (Set to Repel), increasing the Amount to something high should make the effect sharper - obviously, this is situational and depends on the outcome you want to achieve.
If you wanted a means of preventing the fish from straying too far, you could use something like a Primitive Collision Affector to act as a bound to help control the fish.
I’ve attached an example file so you can check out the changes.
FlockTest_v2 (1).dfx (1.4 MB)
Thank you so much for the info! This is very close to what I’m looking to achieve so far