I was wondering if this could be added. Specifically when something is clicked, the connected OnClicked event should have an out pin for a reference to the object that was clicked. Theoretically this should be included with OnPressed and OnReleased too, but I mention OnClicked because that’s what I’m using right now.
The reason I request this is because I have about 30 buttons that all use nearly the same function, the only difference being the reference to the object that was clicked, so to make it work the way I want, I have to have a big mess of pins going directly from 30 events to one function. If I had this feature I could hook up all the buttons to one Event Dispatcher and then have the event that is triggered do the rest, making my blueprint much cleaner
A secondary and related request is being able to bind a custom event to OnClicked, OnPressed and OnReleased for a UMG button. If I could do this, I could hook up all 30 buttons without using any extra pins on the Event Graph. It would just be a single event I could deal with. This would be very useful for cleaning up blueprints.
Yeah, considering adding this to all events for all widgets. A good design for the time being is to make one user widget, that contains a button that does all the magic, provides its own event, and pipes the click + whatever parameters you need. If all the buttons do something almost identical, and look the same, sans some text or image differences, that stuff can be parameterized.
About click, is there are any way to get an actor which got clicked by controller from a controller, exact copy of “on clicked event” from actor which return clicked actor in a controller blueprint.
That seems redundant, because I assume the Engine already used a ray trace to find out what was clicked on? And while we are on the subject, would it be possible to also pass some information about the face being clicked on and/or the uv coordinate of the object at the place it was clicked? I assume those value (at least the UV) is already present somewhere in the deferred rendering pipeline?
I didn’t find a good way to manually find the uv coordinates of point where the user clicked. Only thing I could find is the world position, which can be calculated to a uv coodinate only if you have enough information of the mesh being clicked on…
We don’t store it as far as I know. One more trace will not kill you, and you can perfectly customize it to meet specific needs for your usecase, doing custom filtering, continuing to search along a ray if the first hit isn’t one your care about…etc.
Not easily. Simply put that information may not be available. Almost no game uses the visual mesh as the collision mesh, that would be incredibly expensive, so what you’re tracing against isn’t a 1:1 mapping. It also means keeping that information resident in RAM instead of on the GPU. The other option requires you do a custom render pass where you render uv and mesh/actor id into a render target, and then read back the pixel you care about picking. We do this in the editor to get accurate click detection on objects even without collision data on it.
UV is not data we store in any GBuffer. Typically a GBuffer consists of the data, not an indirection to the data. Example, we wouldn’t store uv for the normal map, we’d simply sample the UV0 location of the normal map of the mesh being rendered in the pixel shader, and write it to the normal portion of the GBuffer. Additionally, a UV channel can contain anything, the only one who really knows is the artist/material, and there are multiple UV channels. You may have mirrored uvs/textures, in which case unique locations on a mesh actually share the same UV. Complexity