Skip to content

Ball Path Prediction

RLMarvin edited this page Jan 13, 2019 · 8 revisions

About

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

Sample BallPrediction

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,
}

Example

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("At time {}, the ball will be at ({}, {}, {})"
                         .format(prediction_slice.game_seconds, location.x, location.y, location.z))
Clone this wiki locally