Does anyone know the best way to implement a virtual mouse for a UMG that is in world (Unreal 4.6)? Been taking a look at the new UMG stuff in 4.6 and we are hoping to use a virtual mouse like we have done in Unity projects for the Oculus Rift. In Unity we just sent a raycast and mapped the collision to point to the UI and fired events if the player focused on a GUI element for amount of time.
Does anyone know the best approach on how to trigger the events in UMG without hacking the engine?
I have a quick question for you. When you say “virtual mouse” do you mean a custom mouse? Also, if you could provide more information on the projects that you spoke of in your post I might be able to get a better grasp of what it is exactly that you are trying to achieve. I would like more information on what it is exactly that you are hopping for.
What I meant as a virtual mouse is more of a virtual mouse pointer using something like the look vector of the players camera to dictate where our ‘virtual mouse’ is on the GUI and firing events such as hover when the player actually looks at an icon or a click event if the player looks at the icon for a set time.
This is very useful for VR in general and also essential for the Gear VR as you cant be certain a user of the device will have a input device such as the joystick to navigate the menus but the user will always be able to look at things to interact.
As for an example of it being implemented take a look at this video. It is an example of a virtual mouse GUI that we did for the Gear VR.
Wouldn’t it be possible to use the same setup you would use for a crosshair?
Render the “crosshair” texture at “Screen Width / 2 - Texture Width / 2” and “Screen Height / 2 - Texture Width / 2”. This should be the middle of the screen.
Now i would use the Event Tick to make a Singe Line Trace.
For the StartPoint you would use the Character Position, which is the position of his feet + the height of the Camera for the z Axis. This should be the middle point of the screen. For the Endpoint, you would take the Start Point and add the Camera Forward Vector multiplied with the distance of the line trace to it.