// Update is called once per frame public override void AgentReset() { MovePickup(); academy = FindObjectOfType <DriverAcademy>(); float rot = academy.resetParameters["veh_rotation"]; Vehicle.transform.position = Vehicle.transform.parent.position + new Vector3(500f, 200f, 500f); Vehicle.transform.eulerAngles = new Vector3(0f, Random.Range(0f, rot), 0f); Vehicle.GetComponent <Rigidbody>().velocity = new Vector3(0, 0, 0); Vehicle.GetComponent <Rigidbody>().angularVelocity = new Vector3(0, 0, 0); putOnSurface(Vehicle); }
void MovePickup() { float xpos; float ymin; float ymax; float targetsize; academy = FindObjectOfType <DriverAcademy>(); xpos = academy.resetParameters["target_x_bounds"]; //Debug.Log(xpos); ymin = academy.resetParameters["target_z_min"]; ymax = academy.resetParameters["target_z_max"]; targetsize = academy.resetParameters["target_size"]; Target.transform.position = Target.transform.parent.position + new Vector3(Random.Range(-1 * xpos, xpos), 0.2f, Random.Range(ymin, ymax)); Target.transform.localScale = new Vector3(targetsize, targetsize, targetsize); targetsize = academy.resetParameters["target_size"]; putOnSurface(Target); }
void OnTriggerEnter(Collider col) { //Debug.Log("something"); if (col.gameObject.tag == "Pick Up") { AddReward(pickUpReward); Debug.Log("pickup"); academy = FindObjectOfType <DriverAcademy>(); if (academy.resetParameters["maxscore"] > 1.0) { MovePickup(); } if (academy.resetParameters["maxscore"] <= 1.0) { Done(); AgentReset(); } //if (currriculum stage == early){ //Done(); //AgentReset(); //} } if (col.gameObject.tag == "wall") { AddReward(-crashPenalty); Debug.Log("agent hit wall"); academy = FindObjectOfType <DriverAcademy>(); float rot = academy.resetParameters["veh_rotation"]; Vehicle.transform.position = Vehicle.transform.parent.position + new Vector3(500f, 2f, 500f); Vehicle.transform.eulerAngles = new Vector3(0f, Random.Range(0f, rot), 0f); } }