update goal every cycle

make distinction between world pos and relative goal pos
This commit is contained in:
Bart Moyaers
2019-06-27 11:27:34 +02:00
parent 293a76e879
commit f73eab5803
2 changed files with 17 additions and 7 deletions

View File

@@ -27,8 +27,9 @@ class Goal:
def __init__(self, goal_type: GoalType):
self.goal_type = goal_type
self.generateGoalData()
self.is_hit_prev = False
def generateGoalData(self):
def generateGoalData(self, modelPos=[0,0]):
if self.goal_type == GoalType.NoGoal:
self.goal_data = []
@@ -39,7 +40,7 @@ class Goal:
rot = randomVal(-1, 1) # radians
self.is_hit = False
self.is_hit_prev = False
# The max distance from the target counting as a hit
self.hit_range = 0.2
@@ -50,6 +51,7 @@ class Goal:
# Y axis up, z axis in different direction
self.goal_data = [-x, z, y]
self.world_pos = [-x + modelPos[0], z, y + modelPos[1]]
elif self.goal_type == GoalType.TargetHeading:
# Direction: 2D unit vector