/// <summary> /// Check for collision with a target. /// </summary> void OnCollisionEnter(Collision col) { if (col.transform.CompareTag(Target)) { touchingTarget = true; agent.AgentReset(); } }
/// <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.AgentReset(); agent.Done(); } } }