Exemple #1
0
    def step(self, dt: float):
        if self.phase == "anti-fake-kickoff":
            self.drive.target_pos = vec3(120 * sgn(self.car.position.x), 0, 0)
            self.finished = self.info.ball.position[1] != 0

        self.action.step(dt)
        self.controls = self.action.controls
Exemple #2
0
    def step(self, dt):

        recovery_time = 0.0 if (self.target is None) else 0.4

        if not self.jump.finished:

            self.jump.step(dt)
            self.controls = self.jump.controls

        else:

            if self.counter == 0:

                # double jump
                if self.target is None:
                    self.controls.roll = 0
                    self.controls.pitch = 0
                    self.controls.yaw = 0

                # air dodge
                else:
                    target_local = dot(self.target - self.car.position,
                                       self.car.orientation)
                    target_local[2] = 0

                    target_direction = normalize(target_local)

                    self.controls.roll = 0
                    self.controls.pitch = -target_direction[0]
                    self.controls.yaw = clamp11(
                        sgn(self.car.orientation[2, 2]) * target_direction[1])

                    if target_local[0] > 0 and dot(self.car.velocity,
                                                   self.car.forward()) > 500:
                        self.controls.pitch = self.controls.pitch * 0.8
                        self.controls.yaw = clamp11(self.controls.yaw * 5)

            elif self.counter == 2:

                self.controls.jump = 1

            elif self.counter >= 4:

                self.controls.roll = 0
                self.controls.pitch = 0
                self.controls.yaw = 0
                self.controls.jump = 0

            self.counter += 1
            self.state_timer += dt

        self.finished = self.jump.finished and self.state_timer > recovery_time and self.counter >= 6
Exemple #3
0
    def __init__(self, car: Car, use_boost=False):
        self.car = car
        self.use_boost = use_boost
        self.controls = Input()

        self.dodge = Dodge(car)
        self.dodge.duration = 0.12
        self.dodge.direction = vec2(car.forward() * (-1))

        self.s = 0.95 * sgn(
            dot(self.car.angular_velocity, self.car.up()) + 0.01)

        self.timer = 0.0

        self.finished = False
Exemple #4
0
 def __init__(self, car: Car, info: GameInfo):
     super().__init__(car, info)
     self.drive.target_pos = vec3(0, sgn(info.my_goal.center[1]) * 100, 0)