How to make widget menu appear when an object is clicked upon?

Okay, so I have an interior scene and I would like to create an interactive experience where the objects highlight when mouse cursor is hovered over them.
Check this video for what I wanthttps://youtube.com/watch?v=zcfeE3P8qeU
I have got it working upto the part where my object is highlighted when mouse cursor is over them. But when I click on them the widget menu doesn’t appear.
Any ideas?
I have checked the below mentioned video but not working.

2 Likes

Can you show your code for the click and widget creation?

There is a very simple price of code within this tutorial that will do what your looking for. Basically your calling some vr tech and when player clicks on in game object, you can cast widget add to view port with it. I used it in our game. Works great.

I followed this tutorial https://www.youtube.com/watch?v=ItG-YLg8xWk and only changed linetracebycahnnel to linetracebyobject.
Attaching my blueprint.

Thanks. Will check it out tomorrow.

I’m probably missing something here, but I don’t see a ‘addwidgettoviewport’ node :slight_smile:

This blueprint is just for detecting a static mesh and apply a post process material to it so no need for “addtoviewport” here.
This is working fine but I want to click on the highlighted object to create a menu.
I tried it last day on my own but nothing worked so gave it up. Will work again tomorrow with fresh mind. In the meantime, if you could tell me what needs to be added here to get what I want here, would be great.

So, you need to place a widget interaction inside your character mesh, you can add it inside the viewport, next you need to place an object in your game (ex. a plane) and call widget to be placed on object. next you write the very basic code on your character(the second picture) then inside your widget bp, when play clicks on widget you will call widget, add to viewport. super simple. you dont need to say delay open level, thats just what im using it for in my game.

oh and make sure you adjust the pointer length, essentially its a laser pointer that can transmit data back and forth. pretty cool

If you’ve got as far as making the object highlight when then play mouses over it, the only thing remaining is to add the widget when they click it.

To do this you need 3 things:

  1. Line trace ( when they click you do a line trace from the camera to the object so you know which object they’re using )

  2. Blueprint interface ( the ‘object’ need to actually be a least a simple blueprint containing only the mesh, but also responding to interface calls )

  3. If you do the line trace and find an object, and send an interface call to the object and it supports that interface, then the object can use the AddWidgetToViewport call to open a widget for you.

For more info:

Line trace:

Blueprint interface:

The neat thing about using the BP interface, is that each object can open a widget that is relevant to ‘it’. :slight_smile:

Thanks, guys for your replies. I didn’t get time due to busy schedule and also my broken keyboard. I tried to play with my older blueprint and got it working.
Now when I click on any highlighted object a menu pops up and I can interact with it.
But now I want the object click to open it’s specific widget.
For eg, if I click on sofa it opens a widget to change sofa color. And if I click on floor it opens a widget to change floor color.
I will try to find time and see the mentioned videos, methods and try to find a solution. Thanks again

Okay guys, so I did some work using blueprint interface and it worked. Thank you so much for your help.

Can you give the tutorial for this issue? I have the same problem with you, hope you share the tutorial that works, thank you so much

Hi guys,
can you please make a tutorial about this topic? I have the same issue and still it is not working