hotrod probably broken

This commit is contained in:
2024-04-24 11:37:48 +02:00
parent a3e7fee19a
commit 185205ceea
12 changed files with 136243 additions and 1240 deletions

View File

@@ -47,8 +47,8 @@ public class AgentController: Agent
// Find all child GameObjects that have the WheelControl script attached
wheels = GetComponentsInChildren<WheelControl>();
startPosition = transform.localPosition;
startRotation = transform.localRotation;
startPosition = transform.position;
startRotation = transform.rotation;
}
@@ -76,21 +76,20 @@ public class AgentController: Agent
// reset car
transform.localPosition = startPosition;
transform.localRotation = startRotation;
transform.position = startPosition;
transform.rotation = startRotation;
rb.velocity = Vector3.zero;
rb.angularVelocity = Vector3.zero;
//randomize car position
// //randomize car position
float rng = UnityEngine.Random.Range(-3f, 3f);
// int rng = UnityEngine.Random.(-3, 3);
// float rng = UnityEngine.Random.Range(-3f, 3f);
transform.localPosition = new Vector3(
transform.localPosition.x,
transform.localPosition.y,
transform.localPosition.z + rng
);
// transform.position = new Vector3(
// transform.position.x,
// transform.position.y,
// transform.position.z + rng
// );
@@ -114,8 +113,8 @@ public class AgentController: Agent
sensor.AddObservation(angleToCheckpoint(currentCheckpoint));
// relative vector pointing to checkpoint
Vector3 position = transform.localPosition;
Vector3 checkpointPosition = currentCheckpoint.localPosition;
Vector3 position = transform.position;
Vector3 checkpointPosition = currentCheckpoint.position;
Vector3 toCheckpoint = new Vector3(
checkpointPosition.x - position.x,
@@ -123,7 +122,7 @@ public class AgentController: Agent
checkpointPosition.z - position.z
);
float carAngle = transform.localEulerAngles.y;
float carAngle = transform.eulerAngles.y;
toCheckpoint = Quaternion.Euler(0, -carAngle, 0) * toCheckpoint.normalized;
@@ -353,7 +352,7 @@ public class AgentController: Agent
float angleToCheckpoint(Transform checkpoint)
{
Vector3 checkpointDirection = checkpoint.localPosition - transform.localPosition;
Vector3 checkpointDirection = checkpoint.position - transform.position;
float angle = Vector3.SignedAngle(transform.forward, checkpointDirection, Vector3.up);
return angle;

View File

@@ -22,7 +22,7 @@ public class CarLoader : MonoBehaviour
}
catch (System.Exception)
{
carType = "Racecar";
carType = "Bulldozer";
carColor = "Default";
print("no loading");
}