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?
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 :)
Instead of using UMG: rendering a quad with a reticle texture, then setting 'Disable Depth Test' gives the correct result.
Related
I have a VR project for which I am trying to render a canvas to be "always on top" of everything using a separate UI camera as noted here.
I made my UICamera object a child of the main camera - which is the centerEyeAnchor object in the OVRCameraRig.
And I set the culling mask for my UICamera to only show its layer and removed that layer from the main camera (CenterEyeAnchor).
But in fact the perspective is weird and it seems like the UICamera is offset a little bit but its transform is zero'd out in the inspector, so I don't why it's displaying so weird.
If I set the culling mask to "Everything" for both cameras it's still offset a little.
In general you don't need the UI camera to be a child of CenterEyeAnchor. Move it out to to the top level and zero out the coordinates. The Oculus rig might be doing some magic with IPD or something else and it screws up the pixel-perfectness of UI.
I'm completely new to Unity and I'm starting to work on a little game for my class. The scenario says that the main character should be placed in my home town.
Since I'm not capable of modeling my town, I tried making skybox from google street view images using free plugin I found. It looks ok, so I tried adding an avatar, and that's where I'm having troubles.
When adding an avatar, he falls trough the floor, I suppose because its only image underneath him. Then I tried adding box below his feet, and now he levitates in squat position abowe it.
Has anyone any suggestions or ideas on how to fix this? Or maybe some suggestions on different vay of doing this would also be apprechiated.
Here is a photo of what it looks like now:
https://postimg.org/image/ehklr8sg5/
The reason your character falls is because there is no "floor" yet. The skybox is nothing but a special cube that wraps infinitely around your scene. With the street view images it may appear like the character is standing on solid ground based on the optical illusion of the skybox, but they're actually floating in space. When you press play, the physics engine starts, gravity takes hold, and your character falls.
There are a number of ways to prevent them from falling.
Disable Gravity on Character
This is only a good idea if you're not planning to use physics in your game.
Select your character's root node in the Hierarchy
In the inspector, find the RigidBody component
Uncheck Use Gravity
Add Floors
Add something with a collider on it that doesn't have a RigidBody. The collider will prevent the character from passing through it and the lack of RigidBody will ensure it doesn't also get affected by physics or gravity.
Create > Plane
Set its transform position to 0, 0, 0 so it's centered in the world
Scale it up big enough for your character to land on
Uncheck the Mesh Renderer in the inspector to make the plane invisible
I have successfully enabled 3d object detection through vuforia in Unity. I have attached a crosshair (reticle) at the centre of the screen in screenspace overlay. when the user moves his phone over the 3d object which is produced upon object detection, I want a label to appear when crosshair crosses different parts of the 3d object. I tried many methods including, collision, cursor and reticle. It is not working.
Is there any easy way to implement this so that I can use event trigger pointer enter to make few things happening on the game.
I successfully solved my problem. The solution is using worldspace crosshair.
Most of the crosshairs available in the assets are cemeraspace. therefore using a worldspace corsshair solved my problem. It may be useful to someone in future.
SO I saw a tutorial online how to make a particle system, and I made it. Only thing is, I want to use it for a 2D Menu. So when I add the particles in front of the canvas, they don't show up in 2D. How do I make particles that will show up on a 2D menu?
You can try positioning your Canvas in World Space, then moving it behind the particle system. This will allow the Canvas to be positioned like all the other objects in your scene, and no longer be constrained to the camera.
Here's a guide from Unity on how to do it.
I'm currently working on 3D insects in Unity, and I want to create a material that mimics the way the mantis or the damselfly eyes behave, especially the little black spot in the middle. For the moment I have a very fine material that makes everything I need, but the reflection cubemap I use for the blackspot is aligned with the world axes by default. Which means that the black spot will only move when I move the object, but in my project only the camera is moving.
Hence my question, is it possible to align the cubemap with the camera's axes, so that when I move the camera, the "front" of the cubemap stays in front of the camera, and so on?
PS: I haven't really messed with shaders yet, so perhaps I just need a line of code or something, please feel free to write it!