Search Unity

How can I get Controller's Pointer Position..?

Discussion in 'Daydream' started by aka8880, Oct 29, 2018.

  1. aka8880


    Oct 29, 2018
    sorry for bad English.. I try to do my best to explain my problem...:(

    I wanna make a Video player which has progress bar.

    Whenever I clicked on Progressbar, it's position is wired...
    every time, when I clicked on progress bar, Pointer's position is on 0,0...

    what I wondered is does
    GvrPointerInputModule.Pointer.transform.position returns Controller's position???

    Here is my code.

    public void OnPointerDown() //event trigger onDown

    pointer = GvrPointerInputModule.Pointer.transform.position;

    Debug.Log("Pointer pos" + pointer);


    private void TrySkip(Vector2 tr)
    Vector2 localPoint;

    if (RectTransformUtility.ScreenPointToLocalPointInRectangle(progress.rectTransform, (Vector2)tr, null, out localPoint))
    float pct = Mathf.InverseLerp(progress.rectTransform.rect.xMin, progress.rectTransform.rect.xMax, localPoint.x);

    Debug.Log("PCT" + pct);


    private void SkipToPercent(float pct)
    var frame = videoPlayer.frameCount * pct;
    videoPlayer.frame = (long)frame;