3

I'm creating a VR game, where I'd like to paint a target reticle wherever the user is looking. The reticle is being drawn in world space, and placed at the same depth as the object the user is looking at. (I'm using a line trace to locate the targeted surface and move the reticle to the required depth).

I'm using a UMG widget to paint the reticle in world space.

My issue is that the reticle will occasionally clip through the world. In Unity, I could set up my material shader to paint the reticle over everything else (regardless of relative depth). However, I'm struggling to replicate the same behavior in UE4. I read online that you can set 'Disable Depth Test' on translucent materials, but since my material domain is 'User Interface', I don't believe that is an option.

How should I go about achieving the desired result?

Chris Nolet
  • 8,714
  • 7
  • 67
  • 92

2 Answers2

1

If I understand correctly you want the reticle just before the object you are looking?

I would create an actor called "reticule" or something similar, and within I would add your UMG widget, as well as a box or capsule for collision (capsule would be smoother). I would have this collide with all geometry so that the reticule goes to the trace location, but collides with the object, not allowing the clipping to happen.

You can disable collision for pawns if the reticule begins restricting movement for bots or the player. Hope this helps :)

  • Thanks Michael. That's a cool idea; I hadn't thought about using a collider. (The 'easy' way to do it is to put the reticle 98% of the line trace depth, but there are some edge cases where it still clips: for example, on very oblique surfaces. The collider solution avoids that). I was also thinking about ditching UMG altogether and just rendering a plane with a texture: https://answers.unrealengine.com/questions/63316/oculus-rift-hud-solution.html – Chris Nolet Jul 29 '16 at 17:49
0

Instead of using UMG: rendering a quad with a reticle texture, then setting 'Disable Depth Test' gives the correct result.

Chris Nolet
  • 8,714
  • 7
  • 67
  • 92