Created
April 23, 2017 09:25
-
-
Save tarukosu/2f628d63c0c48425def8332de63b7012 to your computer and use it in GitHub Desktop.
SpawnObject.cs
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 HoloToolkit.Unity.InputModule; | |
using UnityEngine; | |
public class SpawnObject : MonoBehaviour, IInputClickHandler | |
{ | |
public GameObject objectPrefab; | |
void Start() | |
{ | |
InputManager.Instance.PushFallbackInputHandler(gameObject); | |
} | |
public void OnInputClicked(InputClickedEventData eventData) | |
{ | |
if (GazeManager.Instance.IsGazingAtObject) | |
{ | |
var hitInfo = GazeManager.Instance.HitInfo; | |
Instantiate(objectPrefab, hitInfo.point, Quaternion.identity, transform); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment