Created
May 18, 2016 16:07
-
-
Save kaorun55/3868ac5ecc4dd3069c071d1d04a19785 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 UnityEngine.VR.WSA.Input; | |
using UnityEngine.UI; | |
public class DrawMeshChanger : MonoBehaviour | |
{ | |
GestureRecognizer recognizer; | |
public SpatialMapping mapping; | |
public bool isWireframe = true; | |
public Material Wireframe; | |
public Material Occlusion; | |
public Text text; | |
// Use this for initialization | |
void Start() | |
{ | |
Debug.Log("DrawMeshChanger.Start"); | |
// エラータップジェスチャーを認識させる | |
recognizer = new GestureRecognizer(); | |
recognizer.TappedEvent += Recognizer_TappedEvent; | |
recognizer.StartCapturingGestures(); | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
text.text = mapping.IsMeshCreated ? "" : "Now Mesh Generating..."; | |
} | |
private void Recognizer_TappedEvent(InteractionSourceKind source, int tapCount, Ray headRay) | |
{ | |
Debug.Log(string.Format("Recognizer_TappedEvent : {0}", isWireframe)); | |
// マテリアルを変更する | |
mapping.SetMaterial(isWireframe ? Occlusion : Wireframe); | |
isWireframe = !isWireframe; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment