threejs-worldgen
    Preparing search index...

    Class StarSystem

    A star system: resolved bodies plus their positions, velocities and orientations at any time. Positions are in the star's frame (the star sits at the origin), float64 metres.

    const system = new StarSystem({ home: { radius: world.radius }, planets: 6, seed: 'kepler' })
    system.position('moon', t) // [x, y, z] metres from the star
    system.orientation('home', t) // body → star-frame rotation (Mat3)
    Index
    bodies: Body[]

    Every body: star first, then home, moon, procedural planets and extra bodies.

    options: SystemOptions

    Resolved options.

    • Periapsis/apoapsis of a body's orbit around its parent, with their conventional names (perigee/apogee for the home planet's moons, perihelion/aphelion around the star). null for the star.

      Parameters

      • body: string | number
      • from: number = 0

      Returns Apsides & { names: [string, string] } | null

    • Looks up a body by name or index.

      Parameters

      • body: string | number

      Returns Body

      If there is no such body.

    • Orientation at time: the rotation taking body-fixed vectors into the star frame (tilt, then spin). The tilt leans the north pole towards ecliptic longitude 90° (−Z), like Earth's.

      Parameters

      • body: string | number
      • time: number

      Returns Mat3

    • Orbital period of a body around its parent, seconds (0 for the star).

      Parameters

      • body: string | number

      Returns number

    • Position in the star frame at time, metres.

      Parameters

      • body: string | number
      • time: number
      • out: Vec3 = ...

      Returns Vec3

    • Length of a body's solar day (noon to noon), seconds. For moons, relative to their parent's star.

      Parameters

      • body: string | number = 1

      Returns number

    • Spin angle (radians) about the body's own +Y axis at time.

      Parameters

      • body: string | number
      • time: number

      Returns number

    • Velocity in the star frame at time, m/s.

      Parameters

      • body: string | number
      • time: number
      • out: Vec3 = ...

      Returns Vec3