Home    LittleBigPlanet 2 - 3 - Vita - Karting    LittleBigPlanet 2    [LBP2] Help!
#1

How to make a fish shoal move?

Archive: 7 posts


Does anyone know how to get objects, in my case fish, behave like... well, fish


http://www.youtube.com/watch?v=zvfY8-3ktNA

Now I've managed to get them to disband and regroup if a bigger fish swims through the group, but I can't seem to get the fish to keep on moving in one direction once they have regrouped. Step 3 in the picture below:

http://cache.gyazo.com/864d390cb68ae44aeffef0c0fcc9ed9f.png

Another problem I have is that they tend to clump together upon regrouping. I want them to stay in formation. Not necessarily the same formation, but at least a tiny bit apart from each other.
2011-08-08 14:02:00

Author:
Unknown User


Quite a simple solution involving very little logic could be to attach the fish to long piece of hollow using string (or elastic?). The movement of the holo (or multiple holos) would dictate the movement of the entire shoal, effectively the fish would be pulled along by the string. When something gets near you can have followers turn on to flee the object when it gets near. Maybe even have a secondary follower set to flee all other fish if they seem to get tangled or stuck to one another when no threats are around.2011-08-08 14:21:00

Author:
Xaif
Posts: 365


You could also just have the big fish activate a NOT gate, so that when its in range, the little fish stop moving and something else activates, when the big fish goes out of range, they go back to normal.2011-08-08 14:34:00

Author:
ATMLVE
Posts: 1177


Thank you both.
I ended up just labeling each fish so that each always returns to one specific tag on a moving holo. All seems to work so far.
2011-08-08 15:02:00

Author:
Unknown User


http://i0.lbp.me/img/ft/000b5c0ce9df47a8f92c3e664cc2e9be3d70c340.jpg

Here is what I made for you. Tested and it matches your description.

A 3-gate selector is the center of the fish's logic. Furthermore it has a green tag 'fish', a material tweaker (0% friction, indestructible, no sound) and a grav tweaker (100% anti). Three microchips are hooked up from the selector, representing three situations that can occur:

gate #1: the default, fish follow the shoal. A follower makes the fish follow the tag 'shoal' (set on the holo block you see in the center), range 150, speed 8, acc 100%. A tag sensor below it detects green tag 'fish', range 25, and activates gate #2.

gate #2: a fish is repelled by another fish within range of 25. The follower on chip #2 is set to flee green tag 'fish' within 25 radius, speed 8, 100% acc. The tag sensor below it is an inverted version of the one on chip #1; when no green tag 'fish' is within 25 range, it will activate an OR gate that leads back to port #1, turning the fish back to its default behavior. You will see a constant switching between #1 and #2 as fish seek the shoal but repel one another when coming too close.

gate #3: a wild carp appears! A red tag sensor, range 50, detects the carp on the right and instantly switches the selector to gate #3. On chip #3, a follow makes the fish flee from the red tag, speed 8 (or whatever you pick), acc 100%. The tag sensor below it is the inverted version of the red tag sensor, detecting no carp within range 50, and activates the other port of the OR gate, returning the fish to its default behavior.

Moving the shoal as a hole will mean you have to move the holo block by, for instance, another follower or a basic mover. You see on the holo chip I also put an emitter, to make it easier on myself to generate a lot of fish.

In the pic with me is Tjaldex225. Hi dude!

Edit: be sure to use this order in the selector. Two consecutive input signals on the selector will make it pick the highest number. That is the way it is set up: fleeing from fish is more important than following the school, but fleeing from a carp is the most important of it all.

Edit 2: instead of followers, which are kind of instant movers that leave no room for alternative added movement, you can choose to experiment with look-at rotators: #1 look at shoal, #2 look away from fish - turn the rotator 180 degrees - and #3 look away from carp. Then add a simple mover that makes it move forwards all the time, set to Local space, and you might end up with fish that move more naturally, swimming around each other all the time.
2011-08-08 21:01:00

Author:
Antikris
Posts: 1340


Thanks Kris. As I said (Lorikeet and I are the same person) I got it to work already, but if I'm not 100% satisfied I will definitely give your solution a try. 2011-08-09 07:32:00

Author:
Syroc
Posts: 3193


As far as I understand it each fish reacts to its neighbours surrounding it, so the problem of recreating the ripple-like movement of a shoal won't be solved by a centralised system that relies on 1 fish leading the pack or by creating behaviour that effects all the fish simultaneously.2011-08-09 12:49:00

Author:
Ayneh
Posts: 2454


LBPCentral Archive Statistics
Posts: 1077139    Threads: 69970    Members: 9661    Archive-Date: 2019-01-19

Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.