Hi all, please need little help with my script. I am trying to paint at the position of my right hand controlelr (using the Oculus Touch-Right Trigger), however, the code I have made does not paint from the position of my right-hand controller, but is static at some fixed point in the world. I think he has something to do with the fact that maybe I am not telling the script to follow some global transform functions. Please, could you help me to understand how I get it work? also, it seems that when i trigger the controller …before it draws gives me a flat line …but again not sure why… it should only draw??
thank you so much. I also made a video to show the problem.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DrawLineManager : MonoBehaviour {
public Material lMat;
private GraphicsLineRenderer currLine;
private int numClicks = 0;
// Update is called once per frame
void Update () {
;
if(OVRInput.GetDown(OVRInput.RawButton.LIndexTrigger)){
GameObject go = new GameObject ();
go.AddComponent ();
go.AddComponent ();
currLine = go.AddComponent ();
currLine.lmat = lMat;
currLine.SetWidth (.1f);
numClicks = 0;
}
else if (OVRInput.Get(OVRInput.RawAxis1D.LIndexTrigger)>0f) {
currLine.AddPoint(OVRInput.GetLocalControllerPosition(OVRInput.Controller.RTouch));
numClicks++;
}
}
}