private const string Ground = "ground"; // Tag of ground object. /// <summary> /// Check for collision with ground, and optionally penalize agent. /// </summary> void OnCollisionEnter(Collision col) { if (col.transform.CompareTag(Ground)) { touchingGround = true; if (penalizeGroundContact) { agent.SetReward(groundContactPenalty); } if (agentDoneOnGroundContact) { agent.Done(); } } if (col.transform.CompareTag("Obstacle")) { agent.SetReward(groundContactPenalty * .5f); } }
private const string Ground = "ground"; // Tag of ground object. /// <summary> /// Check for collision with ground, and optionally penalize agent. /// </summary> void OnCollisionEnter(Collision col) { if (col.transform.CompareTag(Ground)) { touchingGround = true; if (penalizeGroundContact) { agent.SetReward(groundContactPenalty); } if (agentDoneOnGroundContact) { agent.MyDoneFunc(true, true); } } }
private const string Obstacle = "obstacle"; // Tag on obstacle /// <summary> /// Check for collision with a target. /// </summary> void OnCollisionEnter(Collision col) { if (col.transform.CompareTag(Obstacle)) { touchingObstacle = true; if (penalizeObstacleContact) { agent.SetReward(obstacleContactPenalty); } if (agentDoneOnObstacleContact) { agent.Done(); } } }
/// <summary> /// Check for collision with ground, and optionally penalize agent. /// </summary> void OnCollisionEnter(Collision col) { if (col.transform.CompareTag(Ground)) { touchingGround = true; if (penalizeGroundContact) { agent.SetReward(groundContactPenalty); if (buddyAgent) { buddyAgent.AddReward(-groundContactPenalty); } } if (agentDoneOnGroundContact) { agent.Done(); if (buddyAgent) { buddyAgent.Done(); } } } }