Challenge: Making game objects or mesh quads act like fish or nettle or sea snakes.
Target: Each game object follows a target position, managed the type of AI (bait ball, random, or schooling)
Look: Game object transforms always look at their look position. Look is the smoothed version of the target position as it changes by throttling.
Collision Avoidance: Each game object will avoid its nearest neighbor. AI adjusts the target in an away direction.
Predator Avoidance: Predator game objects are avoided with max speed.
Feeding: Food game objects become target positions, thereby attracting fish game objects in their direction.
Schooling: Game objects are attracted to the nearest game object of the same type, and maintain an average distance.
Idle: When no targets, avoids and neighbors are in range, game objects wander within a set volume.
Smoothing: The look position is affected by the target position by a small weight, causing look to be smooth compared to target.
Ranges: Each game object type has different ranges for sensing predators, food, neighbors and obstacles.
Easy to Implement: An array of game objects are managed with an array of looks and array of targets. The AI algorithm controls the targets, and keeps the game objects looking at and following targets.
A simple physics nettle surrounded by billboards with no transparency.
These are procedural nettles using game objects and Follow AI.
The 3D content is in the window. Low resolution billboard at 256 x 256.
Manually changing the pitch, yaw, roll of billboard to test transform code.
Simple fish testing billboard. AI controls the parent game object of the billboard.
Game object states are indicated by colored spheres and captions for debugging.
AI also controls procedural fish-like game objects.
Adjustable inner radius, thickness and center.
Fish bowl with billboarded seaweed, fish and others.
Game object states showing red as avoid.
Looking into a virtual fish tank from the other side using webcam in Unity.
AI controls thousands of quads on a single mesh and one fish image.
Simple physics is fast, only using transform LookAt. AI controlls the tops.
Krill bait ball with a procedural fish swimming upstream.
Follow AI uses transform LookAt for tentacle segments. Procedural nettle manages its own physics, while Fish AI manages position, direction and speed.
Seeing how many games objects can be shown at 120fps.
Seeing if no collision avoidance is noticeable. It is.
Hundreds of multi-segment game objects with wandering.
Fish turn orange and avoid when the green predators are near.
Soup-like movement for kelp, maybe.
Each segment is a game object, following the leader. The leader is AI-controlled.
Using target and look points to control game objects or mesh quads.
Testing personal space AI, or collision avoidance for schooling or wandering.
Using waypoints to manage fish behavior around a coral reef, or manage butterflies between flowers. Waypoints are user-provided game objects under an empty parent.