This is what i’m trying to make. The 2 semicircles are supposed to move towards the circle and when the player pushes a button and one of the two semicircles get close enough to the circle the player wins but when the player pushes a button at the wrong time they lose. The rectangles in the picture are just placeholders for the “Trigger” that i will put once i know what it is. Now that everyone knows what i’m making here, I hope someone knows how to do what i’m doing.
do you mean detecting if say the cursor is over a UI element (like a button)?
or having a piece of your UI respond to something happening in the level (like being in front of a door)?
or are you thinking of something else (please elaborate if so)
sort of. other parts of the ui are supposed to interact with each other because this part of the ui is like a rhythm game.
things like a button can already have Events ready.
either
- in the designer select your element, and in the details panel scroll down to Events
- or in the graph if the element is already marked as “is Variable” you can select it under variables, and go down to Events to add it that way.
(remember that different elements can have different events applied to them and some like size boxes really can’t)
one of them should be “on Hovered” which will have the element act as though it was a trigger box, giving you the equivelent of onBeginOverlap()
for OnHovered()
and OnEndOverlap()
for OnUnHovered()
you can have these events change values in your other elements if you really want to say given 4 boxes in a line all blue, hover over the 1st one will change it, the 2nd, and 4th to be Red
but i’m using images not buttons and they don’t have any events for overlapping so i’m looking for a panel that would have these events.
Even if a “ui trigger” didn’t exist how would i make my own code so if an element is near another element then it would act like a trigger and either do a failed or a succeeded.
a version for this would be something like put a button as the parent to your image (or you can set the button to have your image instead)
then give the button the OnHovered()
and OnUnHovered()
which will give you the effect of trigger boxes.
to do this without events would be doing something like in Tick()
comparing the mouse cursor location to the outer bounds for each of your “triggers” then when the cursor is inside firing off a given function, and keeping track of the last item that had the hovered state…, but all of this would just be re-creating the functionality of the OnHovered()
locked outside the physics_Tick step which is already optimized for collision bounds checking.
This is what i’m trying to make. The 2 semicircles are supposed to move towards the circle and when the player pushes a button and one of the two semicircles get close enough to the circle the player wins but when the player pushes a button at the wrong time they lose. The rectangles in the picture are just placeholders for the “Trigger” that i will put once i know what it is. Now that everyone knows what i’m making here, I hope someone knows how to do what i’m doing.
There is no collision in UMG for something like this. This is normally done with math - measure the distance between widgets. Placing those elements in a canvas would dramatically simplify it.