Hi! First of all, I’m fairly new to this, so the solution might be right in front of me but I can’t see it. The thing is, I have tried everything to make this work but I can’t seem to achieve it.
I have an actor, which is a billboard image with a collision sphere around it, just like this:
And I also have a widget with a text message and a button to close it.
In my scene, I have various of these actors (number 1, 2, 3, etc.) around, and my intention is to be able to click on them and display the widget (each actor would display a different widget), no matter how far or close thay are, as soon as I can see them (not whitin an area, just anywhere).
I guess It is possible, but I just can’t make the actor clickable.
Thank You!! It worked! What I was lacking was a a custom player controller with the click events enabled. With it activated, clicking on the collision sphere works like a charm
You do not need a custom controller - what you have is fine. The onClick is using Blocked Visiblity channel. Could you share the collision setup of the actor you’re clicking on?
That does not help. It must be something wrong with the controller…
I created a new clean blank project and in that project, it works even with the default collision settings:
But in this project it does not work for any actor no matter what I set. The level has a default settings as well though, there are just a bunch of static mesh actors and instances of the actor I am trying to make clickable.
Will go over my C++ code if there isn’t anything breaking it. But the thing is that the code should not kick in this basic level…
It will work with defaults, sure - I just wanted to highlight the very minimum that’s needed in case you wanted to trim things down.
I created a new clean blank project
and in that project, it works even
with the default collision settings:
What is the element that has the collision? Is there one? You’re showing settings of the root here which has no collision of its own. You need a component that can block visibility response; no components = no collision…
Or you could line trace from the camera towards the cursor.
But the basic actor onClick is reliable enough providing nothing else gets in the way and the interactive element’s screenspace size is larger than a pixel. Clicking on tiny things can get annoying.
Do note that the actor components can implement their own click events if needed:
Would it be ok to assume that for “use mouse for touch” or on touch devices we could use “GetHitResultUnderFingerForObjects” and “GetHitResultUnderFingerByChannel”?