onMount method

  1. @override
void onMount()
override

Called when the owning node enters a live scene graph.

Implementation

@override
void onMount() {
  final world = findAncestorWorld(node);
  if (world == null) {
    throw StateError(
      'KinematicCharacterController mounted with no PhysicsWorld on an '
      'ancestor node',
    );
  }
  if (!world.simulation.supportsCharacters) {
    throw UnsupportedError(
      '${world.backendName} has no character controller',
    );
  }
  final collider = node.getComponent<Collider>();
  if (collider == null || collider.handles.isEmpty) {
    throw StateError(
      'KinematicCharacterController requires a mounted sibling Collider',
    );
  }
  _world = world;
  _collider = collider;
}