Exemple #1
0
        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);
            }
        }
Exemple #2
0
        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);
                }
            }
        }
Exemple #3
0
        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();
                }
            }
        }
Exemple #4
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 (buddyAgent)
                    {
                        buddyAgent.AddReward(-groundContactPenalty);
                    }
                }

                if (agentDoneOnGroundContact)
                {
                    agent.Done();
                    if (buddyAgent)
                    {
                        buddyAgent.Done();
                    }
                }
            }
        }