castShape
castShape(
source,options):ShapeHitResult|null
The nearest collider shape meets moving from from along direction
within maxDistance, named by its entity, with the point on the shape
that touched; null where it meets none. A shape that starts inside a
collider meets it at distance 0 where its move leads further in, and
passes through it where the move leads out, as Rapier’s cast does, so a
camera swept off a wall it rests on is not held at the wall. Pooled, as
castRay’s result is.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
source |
QuerySource |
options |
CastShapeOptions |
Returns
Section titled “Returns”ShapeHitResult | null
Example
Section titled “Example”const swept = castShape(step, { shape: capsule({ radius: 0.3, height: 1.2 }), from, direction, maxDistance: 2, ignore: [character] });