Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

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

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

  1. aka8880

    aka8880

    Joined:
    Oct 29, 2018
    Posts:
    1
    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);


    TrySkip(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);

    SkipToPercent(pct);
    }
    }

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