Author Topic: Flocking system  (Read 1070 times)


  • Playmaker Newbie
  • *
  • Posts: 21
    • View Profile
Flocking system
« on: February 03, 2017, 08:35:05 AM »

I'm trying to make a flocking system to have some fishes swimming (schooling) in a rocky shore diorama I'm doing.

Everything is "working" but i want to make each fish a little far apart from each other, "avoiding contact".

You can see an example here (GIF)
**The amount of fishes right now is only for testing. 
This will be a mobile app and will have 4 types of fish with few quantities each plus other animals.

I am not using rigidbody or physics, I believe it should not be good for mobile but  I'm not sure and I have not tested yet.
The fishes are created in real time with the amount I set and stay there swimming limited in a defined space.  Also, array with constant update of the position of each fish seems to have a big performance impact, even on PC, and I have no idea how to compare the position of one fish with other using the positions inside the array to make the offset because i don't know the index of each instance (clone) there and i don't know how can i find "self" inside the array.

Does anyone know a good way to do this in a way that does not have a big impact on performance?

I know there are scripts for this, but I'm trying to do it using Playmaker only