Skip to main content

Function: detectCircleTerrainCollision()

detectCircleTerrainCollision(circleBody, terrainBody): CollisionManifold | null

Defined in: physics/collision/detect-circle-terrain-collision.ts:29

Detects a collision between a circle-shaped body and a terrain-shaped body, by running the same circle-vs-convex-polygon narrow phase used for detectCirclePolygonCollision against each of the terrain's segments that overlap the circle's local x-range, keeping the deepest resulting contact.

Parameters

circleBody

RigidBody

The body with a CircleShape. Becomes bodyA of the returned manifold.

terrainBody

RigidBody

The body with a TerrainShape. Becomes bodyB of the returned manifold.

Returns

CollisionManifold | null

A CollisionManifold if the shapes overlap, otherwise null.