createColliders method

  1. @override
List<int> createColliders(
  1. int bodyHandle,
  2. Shape shape, {
  3. PhysicsMaterial material = PhysicsMaterial.defaultMaterial,
  4. bool isTrigger = false,
  5. Matrix4? localPose,
  6. int collisionLayer = 0xFFFFFFFF,
  7. int collisionMask = 0xFFFFFFFF,
})
override

Creates collision geometry on bodyHandle and returns one handle per created collider (compound shapes may decompose; how is backend private). Empty means the shape is unsupported by this backend.

Implementation

@override
List<int> createColliders(
  int bodyHandle,
  Shape shape, {
  PhysicsMaterial material = PhysicsMaterial.defaultMaterial,
  bool isTrigger = false,
  Matrix4? localPose,
  int collisionLayer = 0xFFFFFFFF,
  int collisionMask = 0xFFFFFFFF,
}) {
  final handle = _nextHandle++;
  _colliders[handle] = _BasicCollider(
    bodyHandle,
    shape,
    isTrigger,
    collisionLayer,
    collisionMask,
    localPose ?? Matrix4.identity(),
  );
  return [handle];
}