3D Widget controllable via crosshair?

today I toyed around with the 3D widget and the input modes. Would it be possible to add another Input Mode for the crosshair, like I look with the crosshair onto a button, press E / click / etc. and the button fires? That would be very handy!

Hi iUltimateLP,

I’m a little confused. Are you talking about having another option on the 3d widget to fire BP events from a umg button while editing/not in Play in Editor?

I mean you look with the crosshair at a button inside a 3d widget object and then you click and it interacts with the widget. Its just without the mouse, like you have the cursor attached to the center.

I guess you can do it that way, but it’s clear that other ways are necessary.

So, hello Adam by the way :), do you think that what i asked here is doable (currently or later ?)
If you have a solution let me know :slight_smile:

Hey i got a idea on how you can achive this it may be type of hacky :slight_smile:
In this video 4.6 Preview, UMG & Nov #ue4jam Winners 2014 | Feature Highlight | Unreal Engine - YouTube they show of 3D UMG Widgets.

The idea is that is you use the same method as they use to enable Game and UI input mode, when player comes close to widget.
Now the only thing you need to do is set the cursor position to the center of the screen (corsair position) every tick or something, and swap it out for a costume cursor icon, with with Lock Mouse Look to false ofc.

Of course it may be a simpler method of this but its a idea. :slight_smile:

Unfortunatly, this solution will work for OP but not for me.
As my game is for VR, there is no screen center. I must really use Raycast or overlap, but i havent seen anything covering this.

I have no experience with VR so am reching here but.
You stile have a Camera Component on your pawn/ character.

Could you not get the pos and loc of the camera component and trace a line the distance you need.
If it hits the widget then turn on cursor and place it at the trace direction every tick or something and player effectivly moving the cursor by looking.
May not be prety tough am just throwing ideas around here :).

Great idea, unfortunatelly im not that good at this level so could you post a example how to make this in blueprints?

Yes sure i can give it ago, think its just Get the viewport size Viewport SIze X and Y / 2
and set the position of the center with the Set Mouse Position Node on the player controller.

I may be of with some naming am at work and i don`t have UE 4 in front of me.

There isn’t a set Mouse Position node on the player controller…

There most defenetly is :wink: (or i have been halusenating lol) drag a link from the Player Controller it should be there.
Am off work in 3, 1/2 houers i will get a screenshot up for you then.

Hmm I’m on 4.6 and I defenetly do not find this :smiley: But thanks for your screenshot :smiley:

Here you go mate i was somewhat wrong tough its not under the Player Controller but Widget.
But the Get Node is under the player Controller.

And what do you put under the Reply node? Could you post a screenshot of the whole script which would do this like I had in the first post…

Hi Darknoodles,

Unfortunately I don’t have an answer off the top of my head, I have asked another one of our team who is more familiar with UMG and VR to take a look. I can’t promise a response soon as we do prioritize bugs and crashes to general use questions or specific feature inquiries, but once he can get to it he may have an answer to your question.

Here you go mate tested and working 4.6.1 :slight_smile:

Is that OnMouseMove an own made function or how did you get to that? - Forget it, found it already :smiley:

Strange thing about it is when I test it the mouse is not in the middle, I would say a quarter of X and Y… Do you know why? And is there any chance to hide the mouse cursor?

Hi iUltimateLP,

If you want to hide the mouse cursor, use the “Show Mouse Cursor” boolean in your player controller and set that to false. You can reset it to true by checking the checkbox when needed.

Its probeboly due to the local viewport is smaller then the desktop reselution.
If you run in full screen / Imersive Mode am prety sure it be in the midle for you as well.

Get Viewport Size Gets the Absolute size and may be the desktop as i understand it.
Meaning if you are working in the editor and its viewport is smaller then your reselution it will not be correct.(Workaround Imersive Mode Hotkey: F11)

This should not be a issue if you are running Standalone build.
Hope this helps.