shapeCast method
The first thing shape swept from position and rotation along
direction hits within maxDistance, or null.
Implementation
PhysicsHit3D? shapeCast(
Shape3D shape,
Vector3 position,
Quaternion rotation,
Vector3 direction, {
double maxDistance = 1000,
int layerMask = 0xFFFF,
Entity? ignore,
bool includeSensors = false,
}) {
final world = _world;
if (world == null) return null;
final hits = world.shapeCast(
shape,
position,
rotation,
_along(direction, maxDistance),
filter: _filter(layerMask, ignore, includeSensors),
);
return hits.isEmpty ? null : _hits(hits, maxDistance).first;
}