コード例 #1
0
    private void OnTriggerEnter(Collider other)
    {
        PlayerController1 player = other.GetComponent <PlayerController1>();

        if (player)
        {
            player.DisableMovement();
            m_playerTrans = player.transform;

            // Send ray down to get normal of surface
            Ray        ray = new Ray(m_transform.position, -m_transform.up);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit))
            {
                WalkAroundEdge(hit.point, hit.normal, player);
            }

            // Set new gravity
            player.SetGravity(m_gravityVector);
            // Make player able to move again
            player.EnableMovement();
        }
    }