|
@@ -177,12 +177,12 @@ namespace TrafficSimulation {
|
|
if (otherVehicle.maxSpeed < wheelDrive.maxSpeed && otherVehicle.maxSpeed > 0 && dotFront > .8f)
|
|
if (otherVehicle.maxSpeed < wheelDrive.maxSpeed && otherVehicle.maxSpeed > 0 && dotFront > .8f)
|
|
{
|
|
{
|
|
float ms = Mathf.Max(wheelDrive.GetSpeedMS(otherVehicle.maxSpeed) - .5f, .1f);
|
|
float ms = Mathf.Max(wheelDrive.GetSpeedMS(otherVehicle.maxSpeed) - .5f, .1f);
|
|
- Debug.Log(obstacle.name + " slower. lower speed of " +gameObject.name + " to " + wheelDrive.GetSpeedUnit(ms) + "!");
|
|
|
|
|
|
+ //Debug.Log(obstacle.name + " slower. lower speed of " +gameObject.name + " to " + wheelDrive.GetSpeedUnit(ms) + "!");
|
|
wheelDrive.maxSpeed = wheelDrive.GetSpeedUnit(ms);
|
|
wheelDrive.maxSpeed = wheelDrive.GetSpeedUnit(ms);
|
|
}
|
|
}
|
|
else if(otherVehicle.maxSpeed == 0f)
|
|
else if(otherVehicle.maxSpeed == 0f)
|
|
{
|
|
{
|
|
- Debug.Log(gameObject.name + ": Stopping because of " + obstacle.name +"!");
|
|
|
|
|
|
+ //Debug.Log(gameObject.name + ": Stopping because of " + obstacle.name +"!");
|
|
acc = 0;
|
|
acc = 0;
|
|
brake = 1;
|
|
brake = 1;
|
|
wheelDrive.maxSpeed = 0f;
|
|
wheelDrive.maxSpeed = 0f;
|
|
@@ -192,7 +192,7 @@ namespace TrafficSimulation {
|
|
//If the two vehicles are too close, and facing the same direction, brake the ego vehicle
|
|
//If the two vehicles are too close, and facing the same direction, brake the ego vehicle
|
|
if(hitDist < emergencyBrakeThresh && dotFront > .8f)
|
|
if(hitDist < emergencyBrakeThresh && dotFront > .8f)
|
|
{
|
|
{
|
|
- Debug.Log(gameObject.name + "Two close, same direction. Breaking");
|
|
|
|
|
|
+ //Debug.Log(gameObject.name + "Two close, same direction. Breaking");
|
|
acc = 0;
|
|
acc = 0;
|
|
brake = 1;
|
|
brake = 1;
|
|
wheelDrive.maxSpeed = Mathf.Max(wheelDrive.maxSpeed / 2f, wheelDrive.minSpeed);
|
|
wheelDrive.maxSpeed = Mathf.Max(wheelDrive.maxSpeed / 2f, wheelDrive.minSpeed);
|
|
@@ -283,7 +283,6 @@ namespace TrafficSimulation {
|
|
float dist = Vector3.Distance(this.transform.position, detectedObstacle.transform.position);
|
|
float dist = Vector3.Distance(this.transform.position, detectedObstacle.transform.position);
|
|
if(dist < minDist)
|
|
if(dist < minDist)
|
|
{
|
|
{
|
|
- Debug.Log("Detected Object: " + detectedObstacle.name);
|
|
|
|
minDist = dist;
|
|
minDist = dist;
|
|
break;
|
|
break;
|
|
}
|
|
}
|