yolkbot
    Preparing search index...

    Function sphereVsBox

    • Overlaps a sphere with one oriented box.

      The sphere is not quite a sphere: the radius is scaled down towards the box's horizontal faces and left alone towards its vertical ones, so a player is really a slightly squashed ellipsoid that is easier to squeeze between walls than to stand on the corner of something.

      Parameters

      • center: Position

        The sphere's centre

      • radius: number

        The sphere's radius

      • box: Collider

        The box to test against

      • resolve: Position

        Receives the vector that separates the sphere from the box

      • normal: Position

        Receives the surface normal at the contact

      Returns boolean

      Whether the sphere overlaps the box