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