Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

VR "touch screen" interaction

Hey guys, I'm hoping somebody can help me out with setting up vr "touch screen" interactions.

In my game, the player has a tablet that they can take out to access objectives, map, inventory etc. I want the player to be able to interact by touching the screen with the index finger on their virtual hand.

I'm not sure how to handle / set up this interaction though.

I was thinking I could use a Widget Interaction component, but I can't figure out how to have it essentially 'click' the button without the player having to pull the trigger.

Other than that, I'm not sure how to progress. Any help would be really appreciated.

Product Version: UE 4.16
more ▼

asked Jun 23 '17 at 12:37 AM in VR

avatar image

11 6 6 11

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

I just programmed that functionality into my game. So here is what I did:

I have a CollisionComponent that collides with WidgetComponents (Make sure the 'UI' Collision Profile is set up correctly). And I have a WidgetInteractionComponent with the InteractionSource set to Custom.

Every tick I am sweeping the CollisionComponent to where my finger is. The SweepHitResult is the set as the CustomHitResult for the WidgetInteractionComponent. Make sure the CollisionComponent is not attached to your MotionControllerComponent, otherwise the CollisionComponent will have been moved by the MotionControllerComponent already and performing the sweep will do nothing because of that.

After I set the CustomHitResult, I check whether the sweep hit a WidgetComponent and the WidgetInteractionComponent's LastHitResult has the same WidgetComponent and the WidgetInteractionComponent IsOverHitTestVisibleWidget. If that is the case, I call PressPointerKey for the LeftMouseButton. Otherwise I call ReleasePointerKey for the LeftMouseButton.

The reason to check IsOverHitTestVisibleWidget is that it takes a tick or two for the WidgetInteractionComponent to fetch the widgets and PressPointerKey or ReleasePointerKey can not click any buttons, if the WidgetInteractionComponent is not OverHitTestVisibleWidget.

more ▼

answered Jun 27 '17 at 01:24 PM

avatar image

249 26 36 71

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Using the Virtual Reality UE4 template. Create a socket on the MannequinHand_Right skeleton asset. alt text

In BP_MotionController, Create a WidgetInteraction and a Sphere collision component, have them attached to the Scene component. Set the sphere collision presets to UI.

alt text

Scale the sphere and WidgetInteraction to finger size. I used (X=0.050000,Y=0.050000,Z=0.050000) for scale of the sphere and (X=0.500000,Y=0.200000,Z=0.200000) of the WidgetInteraction, I also set the interaction Distance to 25 of the WI.

alt text

Then at begin play use a timer by create event or use game tick to do this: alt text

Then, do the begin and end overlap components: alt text

And now you have your touch screen interaction finger.

See https://github.com/DanielRBowen/MotionControllerVRTemplate for a template that uses it.

tshand1.png (5.1 kB)
tshand2.png (11.3 kB)
tshand3.png (133.8 kB)
tshand4.png (149.9 kB)
tshand6.png (197.3 kB)
more ▼

answered Dec 03 '18 at 11:41 PM

avatar image

6 3 3 5

avatar image CureDespair Dec 11 '18 at 12:37 AM

I have a better VR template on GitHub: https://github.com/DanielRBowen/UE4-VRHands-Template

avatar image CureDespair Dec 22 '18 at 03:12 AM

A template with gamepad input as well: https://github.com/DanielRBowen/UE4-VR-XPlatform-Menu

avatar image KEATE- Jun 13 '19 at 09:02 AM

That's exactly what I want. Thank you.

avatar image KEATE- Jun 13 '19 at 11:42 AM

It works for me,HAHA~

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question