Download

3D Widget Wont Allow Casting for Clicking?

I have a Blueprint in my scene with a Widget attached called “WBP_WallColors”. The idea is for the user to aim at the wall color menu that’s in 3D space, and click buttons on it, including cancel. Right now I can not get the buttons to interact with the trigger pull. Attached is a screenshot where Im simply trying to get the trigger to work.

baa4938fdf37db2bcba5ff1a0d79fae31570877b.jpeg

You can’t interact with a widget with traces like that, they only respond to a cursor, I presume you don’t have a visible cursor in your game?
You get an error because you can’t cast an actor to a widget, since widgets don’t inherit from the actor class.

So to do this with a trace, you would need to manually put in collision boxes around the clickable buttons.
For example in this simple VR menu:

I added collision boxes around each button.
You then do your trace, but get Hit Component instead.

There’s a few ways of working out what has been clicked, when I done it, I used Get DisplayName, and an EndsWith node, you’ll notice my collisions were named with a suffix, which is the index of that button.

But you could also use tags, tag your collision box with either an index, or a string, use a ComponentHasTag node, or get tag node with a switch on string node for example.

Mosel3y,

First, you rock for replying with exactly the information I’m looking for. Thanks a lot for this buddy!

Second, this sounds promising and I will see what I can get. I am setting this up in a VR environment so this definitely the right track! I’ll let you know how it goes!

Thanks again

Mosel3y,

I’m having an issue getting the Hit Component in my Break Hit to register. Could you provide a screenshot of your blueprints? Thanks again!

Make sure your collision boxes block the visibility channel, they don’t by default. Mine are set to the “UI” collision preset. Sorry, I never mentioned that

Man… You’re good. If I were rich I’d hire you tomorrow. Thank a lot buddy!