Esempio n. 1
0
 def update_goal(self, goal, goal_index):
     self.goal_transforms[goal_index].set_transform(r3d.translate(
         goal[0:3]))
     self.goal_arrows[goal_index * 3].set_transform(
         r3d.trans_and_rot(goal[0:3], self.goal_arrows_rot[0]))
     self.goal_arrows[goal_index * 3 + 1].set_transform(
         r3d.trans_and_rot(goal[0:3], self.goal_arrows_rot[1]))
     self.goal_arrows[goal_index * 3 + 2].set_transform(
         r3d.trans_and_rot(goal[0:3], self.goal_arrows_rot[2]))
    def update_goal(self, goal):
        self.goal_transform.set_transform(r3d.translate(goal[0:3]))

        self.goal_arrows[0].set_transform(
            r3d.trans_and_rot(goal[0:3], self.goal_arrows_rot[0]))
        self.goal_arrows[1].set_transform(
            r3d.trans_and_rot(goal[0:3], self.goal_arrows_rot[1]))
        self.goal_arrows[2].set_transform(
            r3d.trans_and_rot(goal[0:3], self.goal_arrows_rot[2]))
    def update_state(self, dynamics, goal):
        if self.scene:
            self.chase_cam.step(dynamics.pos, dynamics.vel)
            self.have_state = True
            self.fpv_lookat = dynamics.look_at()

            self.update_goal(goal=goal)

            matrix = r3d.trans_and_rot(dynamics.pos, dynamics.rot)
            self.quad_transform.set_transform_nocollide(matrix)

            shadow_pos = 0 + dynamics.pos
            shadow_pos[2] = 0.001  # avoid z-fighting
            matrix = r3d.translate(shadow_pos)
            self.shadow_transform.set_transform_nocollide(matrix)
    def update_state(self, dynamics, goals, reached=None):
        if self.scene:
            self.chase_cam.step(dynamics.pos, dynamics.vel)
            self.have_state = True
            self.fpv_lookat = dynamics.look_at()

            for i in range(self.goal_count):
                self.update_goal(goal=goals[i * 3:i * 3 + 3], goal_index=i)

                if reached is not None and reached[i]:  # change to green
                    self.update_goal_color(goal=goals[i * 3:i * 3 + 3],
                                           goal_index=i)

            matrix = r3d.trans_and_rot(dynamics.pos, dynamics.rot)
            self.quad_transform.set_transform_nocollide(matrix)

            shadow_pos = 0 + dynamics.pos
            shadow_pos[2] = 0.001  # avoid z-fighting
            matrix = r3d.translate(shadow_pos)
            self.shadow_transform.set_transform_nocollide(matrix)