Skip to content

Instantly share code, notes, and snippets.

@kaorun55
Created May 18, 2016 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaorun55/3868ac5ecc4dd3069c071d1d04a19785 to your computer and use it in GitHub Desktop.
Save kaorun55/3868ac5ecc4dd3069c071d1d04a19785 to your computer and use it in GitHub Desktop.
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