Skip to main content
New Participant
January 28, 2014

Drawing crosshair at the point my razer hydra is pointing

Hi, im making a first person shooter game with oculus and razer hydra, i wan to make a crosshair to aid the player instead of using laser pointers with his razer hydra that controls the gun.

So, the crosshair will be drawn at the point that my gun is pointing, the problem is that i only managed to made it work with normal camera with world to screen point. But when i cant manage to make it work on oculus camera, i tried drawing on world to screen point on the right camera but nothing is drawn.
    This topic has been closed for replies.

    5 replies

    Inspiring
    January 28, 2014
    I don't think normal 2D GUIs will work. You basically need to draw to a quad in 3D space. Look at how the Oculus main menu works for an example to follow.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    New Participant
    January 28, 2014
    yes, i also tried drawing the OVRCrosshair based on the worldtoscreenpoint of the laser point on right camera . but its drawing at position.x of 2k+ where the original OVRcrosshair's x position is only 600-1k.
    New Participant
    January 28, 2014
    i found another way by drawing the crosshair at the point where the laser ray hits, but i need a way to draw the crosshair before other object because its intersecting them. can i duplicate the camera n set the depth to 1 like how culling for guns works?
    Up and Coming
    January 28, 2014
    The best thing to do is use a custom shader. Set its render queue to "Overlay" instead of Transparent and disable depth testing with "ZTest Always". This will make it render on top of everything.

    Drawing your crosshair directly to the screen in 2D also works though, and will look sharper that way. You just have to make sure to draw it once for each eye, using each camera's method for transforming from world to screen space.
    Up and Coming
    April 7, 2014
    "cybereality" wrote:
    I don't think normal 2D GUIs will work. You basically need to draw to a quad in 3D space. Look at how the Oculus main menu works for an example to follow.


    Cyber- which main menu do you mean?

    EDIT: Nevermind. I found it. Just had to read the manual. :)