removeFromWorld method

void removeFromWorld(
  1. World world
)

Remove the vehicle including its constraints from the world.

Implementation

void removeFromWorld(World world) {
  final constraints = this.constraints;
  wheelBodies.addAll([chassisBody]);
  final bodies = wheelBodies;

  for (int i = 0; i < bodies.length; i++) {
    world.removeBody(bodies[i]);
  }

  for (int i = 0; i < constraints.length; i++) {
    world.removeConstraint(constraints[i]);
  }
}