Last active
July 6, 2018 19:00
-
-
Save TheStoneBook/5c760beac554f0718c637ff7be2d4574 to your computer and use it in GitHub Desktop.
【Unity】Bounds.Containsのテスト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.EventSystems; | |
public class BoundsContainsTest : MonoBehaviour,IDragHandler { | |
[SerializeField] | |
private GameObject EnteredObject; | |
public void OnDrag(PointerEventData data){ | |
Vector3 TargetPos = Camera.main.ScreenToWorldPoint (data.position); | |
TargetPos.z = 0; | |
transform.position = TargetPos; | |
Bounds _bounds = EnteredObject.GetComponent<Collider2D> ().bounds; | |
if (_bounds.Contains (gameObject.transform.position)) | |
{ | |
Debug.Log ("重なってるよー!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment