L
This commit is contained in:
@@ -66,27 +66,11 @@ public class AgentControllerV7 : Agent
|
||||
transform.localRotation = startRotation;
|
||||
rigidBody.velocity = Vector3.zero;
|
||||
rigidBody.angularVelocity = Vector3.zero;
|
||||
|
||||
// reset checkpoints
|
||||
foreach (GameObject checkpoint in checkpoints)
|
||||
{
|
||||
checkpoint.GetComponent<Checkpoint>().isCollected = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void CollectObservations(VectorSensor sensor)
|
||||
{
|
||||
Transform currentCheckpoint = checkpoints[0].transform;
|
||||
foreach (GameObject checkpoint in checkpoints)
|
||||
{
|
||||
bool isCollected = checkpoint.GetComponent<Checkpoint>().isCollected;
|
||||
|
||||
if (!isCollected)
|
||||
{
|
||||
currentCheckpoint = checkpoint.transform;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Transform currentCheckpoint = checkpoints[checkpointsReached].transform;
|
||||
|
||||
// distance to next checkpoint
|
||||
sensor.AddObservation(distanceToCheckpoint(currentCheckpoint));
|
||||
@@ -215,17 +199,7 @@ public class AgentControllerV7 : Agent
|
||||
}
|
||||
|
||||
// rewards
|
||||
Transform currentCheckpoint = checkpoints[0].transform;
|
||||
foreach (GameObject checkpoint in checkpoints)
|
||||
{
|
||||
bool isCollected = checkpoint.GetComponent<Checkpoint>().isCollected;
|
||||
|
||||
if (!isCollected)
|
||||
{
|
||||
currentCheckpoint = checkpoint.transform;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Transform currentCheckpoint = checkpoints[checkpointsReached].transform;
|
||||
|
||||
float checkpintDistance = distanceToCheckpoint(currentCheckpoint);
|
||||
float reward = (1 - Mathf.InverseLerp(0, distanceBetweenCheckpoints, checkpintDistance)) / 500;
|
||||
@@ -242,10 +216,6 @@ public class AgentControllerV7 : Agent
|
||||
|
||||
AddReward(reward);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (checkpintDistance < 0.1f)
|
||||
{
|
||||
currentCheckpoint.GetComponent<Checkpoint>().isCollected = true;
|
||||
|
||||
Reference in New Issue
Block a user