From 4783109d368ae3bd135206b90797cab05f324c55 Mon Sep 17 00:00:00 2001 From: MagDish <2717360869@qq.com> Date: Tue, 12 Nov 2024 16:56:04 +0800 Subject: [PATCH] new --- scripts/gyms/sprint.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/scripts/gyms/sprint.py b/scripts/gyms/sprint.py index 5293952..2533255 100644 --- a/scripts/gyms/sprint.py +++ b/scripts/gyms/sprint.py @@ -280,23 +280,13 @@ class sprint(gym.Env): self.player.terminate() def change_target(self): - original_angle = self.walk_rel_orientation - # 生成一个 -10 到 +10 度之间的随机角度 orientations = random.choice([-1, 1]) - random_angle_delta = orientations * np.random.uniform(45, 60) # 单位是度 + random_target = orientations * 10 # 单位是度 - # 新的角度 - new_angle = original_angle + np.radians(random_angle_delta) # 转换为弧度 + self.walk_rel_target = (15, random_target) - # 计算新的目标向量,保持原来的距离不变 - new_walk_rel_target = np.array([ - np.cos(new_angle) * self.walk_distance * 2, - np.sin(new_angle) * self.walk_distance * 5 - ]) - # 保存新的目标向量 - self.walk_rel_target = new_walk_rel_target def step(self, action): r = (self.