예제 #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);
            }
        }
예제 #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);
                }
            }
        }
예제 #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();
                }
            }
        }
예제 #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();
                    }
                }
            }
        }