Benson V7 be training
This commit is contained in:
@@ -66,6 +66,20 @@ public class AgentControllerV7 : Agent
|
||||
transform.localRotation = startRotation;
|
||||
rb.velocity = Vector3.zero;
|
||||
rb.angularVelocity = Vector3.zero;
|
||||
|
||||
//randomize car position
|
||||
|
||||
float rng = UnityEngine.Random.Range(-3f, 3f);
|
||||
// int rng = UnityEngine.Random.(-3, 3);
|
||||
|
||||
transform.localPosition = new Vector3(
|
||||
transform.localPosition.x,
|
||||
transform.localPosition.y,
|
||||
transform.localPosition.z + rng
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void CollectObservations(VectorSensor sensor)
|
||||
@@ -219,8 +233,7 @@ public class AgentControllerV7 : Agent
|
||||
if (checkpintDistance < 0.1f)
|
||||
{
|
||||
stepsSinceCheckpoint = 0;
|
||||
checkpointsReached += 1;
|
||||
|
||||
|
||||
// If last checkpoint
|
||||
if (checkpointsReached == checkpoints.Count - 1)
|
||||
{
|
||||
@@ -228,6 +241,8 @@ public class AgentControllerV7 : Agent
|
||||
EndEpisode();
|
||||
}
|
||||
|
||||
checkpointsReached += 1;
|
||||
|
||||
//TODO fix variable names
|
||||
|
||||
AddReward(1f);
|
||||
|
||||
Reference in New Issue
Block a user