Created
September 22, 2015 22:25
-
-
Save marcteys/3c542936a9e3f6601211 to your computer and use it in GitHub Desktop.
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 UnityEngine; | |
using System.Collections; | |
public class UnityClick : MonoBehaviour { | |
public LayerMask terrainLayer; | |
void Update() | |
{ | |
if ( Input.GetMouseButtonDown(0)) | |
{ | |
RaycastHit hit ; | |
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition); | |
if (Physics.Raycast(ray, out hit, 100.0f, terrainLayer)) | |
{ | |
Debug.Log(hit.point); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment