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

    Class OBB

    An Oriented Bounding Box (OBB). Essential for the Separating Axis Theorem (SAT) and precise collisions of rotated objects.

    Implements

    Index
    axes: [Vector3D, Vector3D, Vector3D] = ...

    The 3 orthogonal local axes of the OBB (X, Y, Z).

    center: Vector3D = ...

    Center of the OBB in world space.

    halfExtents: Vector3D = ...

    Half-extents of the OBB along its local axes (scaled to world space).

    type: BoundingType = BoundingType.OBB

    The type of the bounding volume.

    • Sets the unscaled local half-extents (and the current halfExtents) from a vector. See setLocalHalfExtents() for why this should be preferred over mutating halfExtents.

      Parameters

      Returns void

    • Returns the radius of a sphere that fully encloses the volume. Used for coarse broad-phase intersection tests.

      Returns number

      The broad radius.

    • Sets the unscaled local center offset.

      Parameters

      • x: number
      • y: number
      • z: number

      Returns void

    • Sets the unscaled local half-extents (and the current halfExtents) from individual components. Use this instead of mutating halfExtents directly when the OBB will later be transformed — it is the value transform() scales from, so it must be updated whenever the untransformed source bounds change (e.g. once per frame before re-transforming).

      Parameters

      • x: number
      • y: number
      • z: number

      Returns void