Download

Change materials of a static mesh with Widget Interaction HTC VIVE

Hey,

I’m totally new to UE4 and working on a project for the university. I’m trying to change materials of a static mesh with a Widget Interaction in VR (HTC Vive). I started with an VR Template and added a new ActionMapping for the Grip Buttons of both Motion Controllers. Then I added a Widget Interaction to the HandMesh of the BP_MotionController (not the Pawn) to get the Debug out of ‘my hand’ and called to the Input Interaction of the new to Action Mappings and put them into Press/ReleasePointerKey…target is the Widget Interaction.

4b6227c2f4f032f016c1e5b5573952051820f1f8.png

I created a new Widget and a WidgetActor_BP with the Widget as a child of the DefaultSceneRoot with these settings:

Widget_Buttons.PNG

Widget_SetMaterial.PNG

Widget_Open_Menu.PNG

32b78684265f7aad1e7de9fef4d57b6db3a68add.jpeg

Moreover I made a BP of the StaticMesh:

e9d73eb48960e38a6a9d5065cf86ce3beba17d02.jpeg

Now when I start the VR Preview I have the debug out of my hand as I wanted and the Hover Functions work: Menu opens and the other buttons change their appearance when hovered.
But it seems as I can’t get any Input from the pressed buttons…so the mesh stays the same.

Anyone an idea what I missed? Or another solution for my problem. It should be something like a Show Room with Car Configurator.

Thanks in advance

-R

you need to use the MotionController facebuttons for your press pointer keys117787-widget.jpg053e45429e7c743dacb08e2097b60c2d8ff21e1b.png

Ok I will try that. Why do you have ‘Left Mouse Buttons’ in the Press Pointer Keys? I did the whole project in a VR Template. And I think there are no Mouse Buttons specified?! I use the Face Buttons for Teleport so can I only use one of them for menu interaction? Everything else is correct?

Thank you very much.

Yes to interact with Widgets UI, you need to emulate mouse pointer and send action, use debug-line there for the preview.
Adjust any MotionController button to trigger few events, such as fire and PressPointerKey LeftMouse key.

Thank you guys but that didn’t work for me. I can still get no input from the Motion Controller. Another idea what the problem could be? @Spawn80 Could you please help me? Seems like you already did what I’m trying to do. Would it be better to start in a First Person Template. How did you set up your Pawn. I use the standard VR Pawn of UE 4.15

I could be wrong but Widget can’t control static mesh in a level like that. Do you have those set material inside Widget or in level blueprint?
Whenever there’s problem try to divide the problem. Have your widget button do something else like console command - stat fps and see if that toggles fps display. And put the material change nodes in level blueprint and have something else like a trigger volume in your level change the material. If both of these work, then problem is probably your widget communicating with your level.
It wasn’t changing materials but I encountered similar issue and had to put the level component nodes in the level blueprint and trigger them using event dispatcher from the widget.
This got a lot more complicated since Looman separated the Pawn and Controller in the VR Template.

The Set Material thing is in the Event Graph of my Widget. I thought I have to do it like this because it’s the only place where I can define the Buttons of my Widget with actions like OnPressed, OnHovered etc. But I can’t even close the menu. Just hovering over the Main Button to open the full menu works. I would try all these things @Taz1004 but as I said I’m in UE4 for only 4 weeks. All of the things I did I learned from Tutorials and I have only 2 days to finalize the project. Could please someone send a screenshot of how to communicate between UI and the Level? And yeah this VR Pawn really sucks, just having problems with it like adding a mesh to the level destroying the whole Teleport function :frowning:

Sorry, of course I wanted to thank you for this precise answer. But another issue I’m running in is that the Pawn doesn’t generate any collision. I already tried triggering some things with Trigger Boxes and Overlap Events but that didn’t work at all. The Pawn is even not rotating with the rotating platform the car stands on

Or has maybe anyone an idea how to solve it like this: https://www.youtube.com/watch?v=xGVFP6CWtDY at 1:38 min?

Ok you still have some time to go…

I have a kind of similar situation:[COLOR=#fff0f5]
[/COLOR]see this VR video https://youtu.be/LwbXB30Bm3Q
I have a menu widget and when I hover on a menu button I want to change the material of the Vive Controller. Here of course the Vive is coming only with 1material(Element 0) but I think that you can see for your needs.
So my BP widget is just doing this:

  1. if hovered button than change the Color of the menu Button

  2. get the mesh (BP Vive Controller) and set the new material.

  3. Play a sequence animation. [COLOR=#fff0f5]

&stc=1

[/COLOR]
I hope that you can see if the idea is good also for you.:slight_smile:

To trigger with the VR pawn see picture.

&stc=1