-
Notifications
You must be signed in to change notification settings - Fork 79
Ball Path Prediction
Virx edited this page Aug 6, 2020
·
8 revisions
This feature gives you the predicted ball path. For more details, see the main wiki at https://github.com/RLBot/RLBot/wiki/Ball-Path-Prediction
To get the ball prediction struct simply call the get_ball_prediction_struct()
function on the BaseAgent which all bots inherit from.
ball_prediction_struct = {
'slices': [
{
'physics': {
'location': {'x': 0.0, 'y': 0.0, 'z': 0.0},
'rotation': {'pitch': 0.0, 'yaw': 0.0, 'roll': 0.0},
'velocity': {'x': 0.0, 'y': 0.0, 'z': 0.0},
'angular_velocity': {'x': 0.0, 'y': 0.0, 'z': 0.0}
},
'game_seconds': 0.0,
},
{ ... }
],
'num_slices': 360,
}
Assume the following is written in a bots get_output()
function. It prints all the predicted locations of the ball.
ball_prediction = self.get_ball_prediction_struct()
if ball_prediction is not None:
for i in range(0, ball_prediction.num_slices):
prediction_slice = ball_prediction.slices[i]
location = prediction_slice.physics.location
self.logger.info(f"At time {prediction_slice.game_seconds}, the ball will be at ({location.x}, {location.y}, {location.z})")