threejs-worldgen
    Preparing search index...

    Class FishSchools

    Fish schools streamed in tiles around the camera, wherever the world has water deep enough: species chosen by water type (river vs sea), temperature and depth; each school a deterministic boids flock that stays between the bed and the surface; swimming animated in the vertex shader.

    const fish = await FishSchools.create({ camera, scene, renderer, world, density: 200 })
    fish.set({ species: { herring: { school: { size: [80, 160] } } } })

    Hierarchy (View Summary)

    Index
    camera: Camera

    Camera the tiles follow.

    frame: LocalFrame

    The frame groups live in (the world itself on flat worlds).

    input: Partial<T> = {}

    Input so far (merged by set).

    object: Group<Object3DEventMap> = ...

    Root object (placed in the current frame).

    salt: 24341 = 0x5f15

    Separates this kind's spawns from other kinds with the same seed.

    Resolved settings. Change them with set() / reset().

    stats: FaunaStats = ...

    Live counters, refreshed by update().

    time: number = 0

    Seconds simulated.

    views: Map<string, SpeciesView> = ...

    Per-species meshes.

    world: World

    The world.

    • Advances member i's animation (motion, 4 floats) and returns its roll (bank) angle.

      Parameters

      Returns number

    • Sets member i's scale (xyz into scale) and look (4 into look) from rand.

      Parameters

      • sp: FishSpecies
      • r: () => number
      • scale: Float32Array
      • look: Float32Array
      • i: number

      Returns void

    • Moves the floating origin. Same as set({ origin }).

      Parameters

      • origin: readonly number[]

      Returns this

    • Streams tiles around the camera, spawns within the time budget, steps the flocks at a fixed rate and writes the instances. Called automatically when a scene was given; otherwise once per frame.

      Parameters

      • delta: number = ...

        Seconds since the last frame; measured if omitted.

      • budget: number = ...

        Milliseconds for spawning this frame. Defaults to settings.buildBudget.

      Returns void