Skip to main content

Function: findCircleContact()

findCircleContact(vertices, normals, localCenter, faceIndex, separation, radius): CircleContact | null

Defined in: physics/collision/circle-polygon-contact.ts:129

Resolves the exact contact (face or vertex) between a circle and the polygon face found by findClosestFace, in the polygon's own local space.

Parameters

vertices

readonly Vector2[]

The polygon's vertices, in its own local space.

normals

readonly Vector2[]

The polygon's outward-facing edge normals, matching vertices.

localCenter

Vector2

The circle's center, in the polygon's local space.

faceIndex

number

The closest face's index, from findClosestFace.

separation

number

The closest face's separation, from findClosestFace.

radius

number

The circle's radius.

Returns

CircleContact | null

The resolved contact, or null if the shapes do not actually overlap (the circle's center lies beyond a vertex, out of radius).