applyAccelerationByAngle method

void applyAccelerationByAngle(
  1. double acceleration,
  2. double angle, {
  3. bool stopWhenSpeedZero = false,
  4. bool updateAngleComponent = false,
  5. double? initialSpeed,
  6. VoidCallback? onStop,
})

Implementation

void applyAccelerationByAngle(
  double acceleration,
  double angle, {
  bool stopWhenSpeedZero = false,
  bool updateAngleComponent = false,
  double? initialSpeed,
  VoidCallback? onStop,
}) {
  _updateAngleComponent = updateAngleComponent;
  _onStop = onStop;
  _type = _TypeAcceleration.angle;
  speed = initialSpeed ?? speed;
  if (speed == 0) {
    speed = 0.01;
  }
  _acceleration = Vector2.all(acceleration);
  _stopWhenSpeedZero = stopWhenSpeedZero;
  _moveAngle = angle;
  if (_updateAngleComponent) {
    this.angle = angle;
  }
}