Created
November 14, 2016 21:40
-
-
Save sabotai/47f8fcc869792b6225bae98128bc8c7b to your computer and use it in GitHub Desktop.
eg
This file contains hidden or 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 UnityEngine; | |
| using System.Collections; | |
| public class grab : MonoBehaviour { | |
| // Use this for initialization | |
| void Start () { | |
| } | |
| // Update is called once per frame | |
| void Update () { | |
| RaycastHit2D hit = Physics2D.Raycast(transform.position, Vector2.right); | |
| Debug.DrawRay(transform.position, Vector2.right); | |
| if (hit.collider != null) { | |
| Debug.Log("grabbed " + hit.collider.name); | |
| } else { | |
| Debug.Log("nothing"); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment