Small World Engine API Reference - v0.76.20
    Preparing search index...

    Class Ray

    Represents a mathematical ray in 3D space.

    Index
    direction: Vector3D = ...

    The normalized direction vector of the ray.

    origin: Vector3D = ...

    The origin point of the ray.

    • Computes the point along the ray at a given distance.

      Parameters

      • t: number

        The distance along the ray.

      • target: Vector3D = ...

        Optional target vector.

      Returns Vector3D

      The computed point.

    • Tests whether this ray intersects the given AABB. Uses the slab method.

      Parameters

      Returns number

      The distance t to the intersection, or -1 if no intersection.

    • Tests whether this ray intersects the given bounding sphere.

      Parameters

      Returns number

      The distance t to the nearest intersection, or -1 if no intersection.