pointTowardsBall(ball) {
    const leftVelocity = this.velocity.copy();
    const rightVelocity = this.velocity.copy();

    const leftRotatedVelocity = leftVelocity.rotate(-PI/36);
    const leftAdjustedPosition = createVector(this.position.x + leftRotatedVelocity.x, this.position.y + leftRotatedVelocity.y);
    const desiredLeft = p5.Vector.sub(ball.position, leftAdjustedPosition);

    const rightRotatedVelocity = rightVelocity.rotate(PI/36);
    const rightAdjustedPosition = createVector(this.position.x + rightRotatedVelocity.x, this.position.y + rightRotatedVelocity.y);
    const desiredRight = p5.Vector.sub(ball.position, rightAdjustedPosition);

    // boost to faraway ball
    if (desiredLeft.mag() > 150) { 
      this.boost() 
    };

    const steerMag = desiredLeft.mag() - desiredRight.mag();
    
    const dir = this.accelerationDirection === 'forwards' ? 1 : -1;
    let rotation = map(steerMag, -0.5, 0.5, -dir * PI/72, dir * PI/72);
    this.rotate(rotation);
  }
// for computer player. weird way to find correct way to rotate...
for computer player. weird way to find correct way to rotate
for computer player . weird way to find correct way to rotate
pointTowardsBall(ball) {
    const leftVelocity = this.velocity.copy();
    const rightVelocity = this.velocity.copy();
    const leftRotatedVelocity = leftVelocity.rotate(-PI/36);
    const leftAdjustedPosition = createVector(this.position.x + leftRotatedVelocity.x, this.position.y + leftRotatedVelocity.y);
    const desiredLeft = p5.Vector.sub(ball.position, leftAdjustedPosition);
    const rightRotatedVelocity = rightVelocity.rotate(PI/36);
    const rightAdjustedPosition = createVector(this.position.x + rightRotatedVelocity.x, this.position.y + rightRotatedVelocity.y);
    const desiredRight = p5.Vector.sub(ball.position, rightAdjustedPosition);
    if (desiredLeft.mag() > 150) { 
      this.boost() 
    };
    const steerMag = desiredLeft.mag() - desiredRight.mag();
    const dir = this.accelerationDirection === 'forwards' ? 1 : -1;
    let rotation = map(steerMag, -0.5, 0.5, -dir * PI/72, dir * PI/72);
    this.rotate(rotation);
  }
pointTowardsBall ( ball ) { const leftVelocity = this . velocity . copy ( ) ; const rightVelocity = this . velocity . copy ( ) ; const leftRotatedVelocity = leftVelocity . rotate ( - PI / 36 ) ; const leftAdjustedPosition = createVector ( this . position . x + leftRotatedVelocity . x , this . position . y + leftRotatedVelocity . y ) ; const desiredLeft = p5 . Vector . sub ( ball . position , leftAdjustedPosition ) ; const rightRotatedVelocity = rightVelocity . rotate ( PI / 36 ) ; const rightAdjustedPosition = createVector ( this . position . x + rightRotatedVelocity . x , this . position . y + rightRotatedVelocity . y ) ; const desiredRight = p5 . Vector . sub ( ball . position , rightAdjustedPosition ) ; if ( desiredLeft . mag ( ) > 150 ) { this . boost ( ) } ; const steerMag = desiredLeft . mag ( ) - desiredRight . mag ( ) ; const dir = this . accelerationDirection === 'forwards' ? 1 : - 1 ; let rotation = map ( steerMag , - 0.5 , 0.5 , - dir * PI / 72 , dir * PI / 72 ) ; this . rotate ( rotation ) ; }
for computer player.
for computer player .
// boost to faraway ball