UnityEngine.Collider2D.OverlapPoint C# (CSharp) Method

OverlapPoint() public method

Check if a collider overlaps a point in space.

public OverlapPoint ( Vector2 point ) : bool
point Vector2 A point in world space.
return bool
        public bool OverlapPoint(Vector2 point)
        {
            return INTERNAL_CALL_OverlapPoint(this, ref point);
        }

Usage Example

コード例 #1
0
ファイル: TeleportDoors.cs プロジェクト: mxz0801/DarkDreams
    void OnTriggerStay2D(Collider2D col)
    {
        ///get position of click
        clickPosition.x = Camera.main.ScreenToWorldPoint(Input.mousePosition).x;
        clickPosition.y = Camera.main.ScreenToWorldPoint(Input.mousePosition).y;
        ///currently, click must be on player
        if (col.tag == "Player" && ((Input.GetKeyDown(KeyCode.Space)) || (col.OverlapPoint(clickPosition) && Input.GetMouseButtonDown(0))))
        {

            if (exit != null)
            {
                cameraScript.follow = false;
                cameraScript.target = exit.transform;

            }
            else
            {
                Debug.Log("no exit assigned");
            }

            Debug.Log("Teleport Complete!"); // confirm that teleport is complete; this can be taken out
            TeleportToExit2D(col);

        }
        /*
        else
        {
            //cameraScript.follow = true;//allows smooth transition for each teleport
        }
        */
    }
All Usage Examples Of UnityEngine.Collider2D::OverlapPoint