gravity property

Vector2 gravity

Don't change the gravity object directly, use the setter instead.

Implementation

Vector2 get gravity => physicsWorld.gravity;
void gravity=(Vector2? gravity)

Sets the gravity of the world and wakes up all bodies.

Implementation

set gravity(Vector2? gravity) {
  physicsWorld.gravity = gravity ?? defaultGravity;
  for (final body in physicsWorld.bodies) {
    body.setAwake(true);
  }
}