Skip to main content
Up and Coming
November 19, 2013

NGUI rendertexture input issues

I use NGUI for all my GUI work and i thought i convert it to a plane using rendertexture so i can get it right with the Rift. This was really easy and i now have the GUI on a simple quad, the issue however is with the input. I cant get it to trigger on the correct place, now i have to move the cursor way over the buttons for them to trigger instead of pressing ontop of the actual button as it should be. Anyone know a solution to this?
    This topic has been closed for replies.

    7 replies

    sh0v0r
    Up and Coming
    November 19, 2013
    "virror" wrote:
    I use NGUI for all my GUI work and i thought i convert it to a plane using rendertexture so i can get it right with the Rift. This was really easy and i now have the GUI on a simple quad, the issue however is with the input. I cant get it to trigger on the correct place, now i have to move the cursor way over the buttons for them to trigger instead of pressing ontop of the actual button as it should be. Anyone know a solution to this?


    I require the use of either keyboard or a gamepad to navigate menus in Lunar Flight.

    Ideally you would use the head trackers orientation and cast a ray from the NGUI Cameras position to trigger touch inputs, but mapping this into a 1:1 space would be tricky. Because of the difference in scale and distance between the UICamera and the OVRCameraController relative to the Quad.
    virrorAuthor
    Up and Coming
    November 20, 2013
    I can trigger the buttons no problem, but the scale seems wrong. Looks like many are using rendertexture for their GUI, so must be a decently easy solution for this?
    Up and Coming
    November 20, 2013
    "virror" wrote:
    I can trigger the buttons no problem, but the scale seems wrong. Looks like many are using rendertexture for their GUI, so must be a decently easy solution for this?

    I have never used NGUI, but if you can share your code I might be able to help.
    virrorAuthor
    Up and Coming
    November 20, 2013
    Your response got me thinking in a different way, and i think i found the theory to solve the issue : p
    Pretty easy actually, using the main camera to calculate the NGUI raycasts instead of the NGUI camera should give the correct results i think, now i just need to figure out how to do that : )
    virrorAuthor
    Up and Coming
    November 21, 2013
    I solved the input issue by doing some scaling inside the UICamera script, dont have the code here but will post i later.
    The problem now is that the whole quad is visible on the screen, how do i get rid of the parts that are not the GUI? I guess i want everything thats not GUI to be transparent, but could not get that to work : /
    Up and Coming
    November 21, 2013
    "virror" wrote:
    I solved the input issue by doing some scaling inside the UICamera script, dont have the code here but will post i later.
    The problem now is that the whole quad is visible on the screen, how do i get rid of the parts that are not the GUI? I guess i want everything thats not GUI to be transparent, but could not get that to work : /

    What material are you using for the surface? You can use the menu material from the OVR package and that should do what you want.
    Up and Coming
    December 20, 2013
    Has anyone figured out how to deal with the UI scale properly? My buttons are way off.