Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class RayCastTest : MonoBehaviour {
- private RaycastHit hit;
- private float range = 300f ;
- public GameObject decal;
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- if (Input.GetMouseButtonDown (0)) {
- Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
- if (Physics.Raycast (ray,out hit,range)){
- Debug.Log ("Hit");
- Instantiate(decal,hit.textureCoord,Quaternion.FromToRotation(Vector3.up, hit.normal));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement