Draw to Controller position Help

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++;
}

}
}

you need to set the position of the first click

some where in here you need to change it’s position.

GameObject go = new GameObject ();
go.AddComponent<MeshFilter> ();
go.AddComponent<MeshRenderer> ();
//change go's position here
currLine = go.AddComponent<GraphicsLineRenderer> ();

currLine.lmat = lMat;
currLine.SetWidth (.1f);

how do I do that ?? sorry please explain i am new to this

I’m not sure about the OVRinputs, but give this a try.
go.transform.position = OVRInput.GetLocalControllerPosition(OVRInput.Controller.RTouch);

one more small error, the line under “void Update() {” you have a ; that should be removed.

not working … it draw at my headset position … but not at my controller position :frowning: