Skip to content

Commit

Permalink
Update BallPredictor.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
VirxEC authored Jul 11, 2024
1 parent 142231a commit 9dc57c2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions RLBotCS/ManagerTools/BallPredictor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,12 @@ public static BallPredictionT Generate(PredictionMode mode, float currentTime, B
else if (currentTime - currentBall.LatestTouch.TimeSeconds < 0.1)
{
// Target goal is the opposite of the last touch
SetHeatseekerTarget(currentBall.LatestTouch.Team == 1 ? (byte)1 : (byte)0);
SetHeatseekerTarget(currentBall.LatestTouch.Team == 1 ? (byte)0 : (byte)1);
}
else if (GetHeatseekerTargetY() == 0 || MathF.Abs(ball.Location.Y) >= 4820)
{
// We're very likely to hit a wall that will redirect the ball towards the other goal
SetHeatseekerTarget(
MathF.Abs(MathF.Sign(ball.LinearVelocity.Y) + 1) < float.Epsilon ? (byte)1 : (byte)0
);
SetHeatseekerTarget(ball.LinearVelocity.Y < 0 ? (byte)1 : (byte)0);
}
}

Expand Down

0 comments on commit 9dc57c2

Please sign in to comment.