view Assets/Application/Scripts/Eye.cs @ 13:e297afe0889d default tip

Add Prefab.
author Kazuma Takeda
date Tue, 07 Feb 2017 20:49:26 +0900
parents 2dd40b4412e4
children
line wrap: on
line source

using UnityEngine;
using System.Collections;

public class Eye : MonoBehaviour {
	
	// Update is called once per frame
	void Update () {
		RaycastHit hit;
		if (Physics.Raycast (transform.position, transform.forward * 10, out hit)) { // Select picture.
			Player.Instance.SetLookedObject (hit.collider.gameObject);
		} else {
			Player.Instance.SetLookedObject (null);
		}
	}
}