Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class DrawLineManager : MonoBehaviour {
- public Material lMat;
- public SteamVR_TrackedObject trackedObject;
- private MeshLineRenderer currLine;
- private int numClicks = 0;
- void Update () {
- SteamVR_Controller.Device device = SteamVR_Controller.Input((int)trackedObject.index);
- if (device.GetTouchDown (SteamVR_Controller.ButtonMask.Trigger)) {
- GameObject go = new GameObject ();
- currLine = go.AddComponent<MeshLineRenderer> ();
- currLine.lmat = new Material (lMat);
- currLine.setWidth (0.1f);
- numClicks = 0;
- } else if (device.GetTouch(SteamVR_Controller.ButtonMask.Trigger)) {
- currLine.AddPoint (trackedObject.transform.position);
- numClicks++;
- } else if (device.GetTouchUp(SteamVR_Controller.ButtonMask.Trigger)) {
- numClicks = 0;
- currLine = null;
- }
- if (currLine != null) {
- // currLine.lmat.color = ColorManager.Instance.GetCurrentColor ();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement