shapeCast method
ShapeCastHit?
shapeCast(
- Shape shape,
- Matrix4 from,
- Vector3 direction,
- double distance, {
- int layerMask = 0xFFFFFFFF,
- bool includeFixed = true,
- bool includeKinematic = true,
- bool includeDynamic = true,
- bool includeTriggers = false,
})
Implementation
ShapeCastHit? shapeCast(
sim.Shape shape,
Matrix4 from,
Vector3 direction,
double distance, {
int layerMask = 0xFFFFFFFF,
bool includeFixed = true,
bool includeKinematic = true,
bool includeDynamic = true,
bool includeTriggers = false,
}) {
final hit = simulation.shapeCast(
shape,
from,
direction,
distance,
layerMask: layerMask,
includeFixed: includeFixed,
includeKinematic: includeKinematic,
includeDynamic: includeDynamic,
includeTriggers: includeTriggers,
);
if (hit == null) return null;
final collider = _collidersByHandle[hit.colliderHandle];
if (collider == null) return null;
return ShapeCastHit(
node: collider.node,
collider: collider,
worldPoint: hit.worldPoint,
worldNormal: hit.worldNormal,
distance: hit.distance,
);
}