characterContacts method

  1. @override
List<CharacterContact3D> characterContacts(
  1. int character
)
override

What character touched in its last update.

Implementation

@override
List<CharacterContact3D> characterContacts(int character) {
  final c = characters[character];
  final ground = c == null ? null : bodies[c.groundBody];
  if (c == null || ground == null) return const [];
  return [
    CharacterContact3D(
      body: ground.handle,
      character: 0,
      position: Vector3(c.position.x, ground.minY, c.position.z),
      normal: Vector3(0, -1, 0),
      velocity: Vector3.copy(ground.linearVelocity),
      distance: 0,
      isSensor: false,
      hadCollision: true,
    ),
  ];
}