@@ -23,14 +23,17 @@ def get_output(self, packet: GameTickPacket) -> SimpleControllerState:
2323 if steer_correction_radians > 0 :
2424 # Positive radians in the unit circle is a turn to the left.
2525 turn = - 1.0 # Negative value for a turn to the left.
26+ action_display = "turn left"
2627 else :
2728 turn = 1.0
29+ action_display = "turn right"
2830
2931 self .controller_state .throttle = 1.0
3032 self .controller_state .steer = turn
3133
32- return self .controller_state
34+ draw_debug ( self .renderer , my_car , packet . game_ball , action_display )
3335
36+ return self .controller_state
3437
3538class Vector2 :
3639 def __init__ (self , x = 0 , y = 0 ):
@@ -68,3 +71,11 @@ def get_car_facing_vector(car):
6871 facing_y = math .cos (pitch ) * math .sin (yaw )
6972
7073 return Vector2 (facing_x , facing_y )
74+
75+ def draw_debug (renderer , car , ball , action_display ):
76+ renderer .begin_rendering ()
77+ # draw a line from the car to the ball
78+ renderer .draw_line_3d (car .physics .location , ball .physics .location , renderer .white ())
79+ # print the action that the bot is taking
80+ renderer .draw_string_3d (car .physics .location , 2 , 2 , action_display , renderer .white ())
81+ renderer .end_rendering ()
0 commit comments