Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
hyperlogin's avatar
hyperlogin
Honored Guest
12 years ago

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.

5 Replies

Replies have been turned off for this discussion
  • 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.
  • 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.
  • 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?
  • owenwp's avatar
    owenwp
    Expert Protege
    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.
  • xhonzi's avatar
    xhonzi
    Honored Guest
    "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. :)