I’ve got a physical button in UE5 (it’s an actual mesh with physics sim, moves down when pressed).I just wanna make it so when this button is pushed, it makes a cube move forward (like calling a function on another BP).Basically: press the button → cube moves.What’s the best way to detect that press and trigger something in another blueprint?
the original blueprint of my button looks like this, what should I add or change so that the cube can move? each button has a single direction of movement, and there are a total of 4 directions (left, right, back, and forward)
Make the button fire a single “pressed” event when its travel passes a small threshold, then call the cube. The clean way is: constrain your button mesh so it only moves along one axis, read its relative location each tick (or with a timer), and when the offset along that axis exceeds, say, 2–3 cm, flip a boolean so it only triggers once and call an event. For communication, either give the button a variable reference to the cube actor and call a Custom Event on the cube (e.g., MoveForward), or create a Blueprint Interface with OnButtonPressed(Direction) and implement it on the cube; the button calls the interface when the threshold is crossed. On the cube, play a Timeline that lerps its location forward (or right/left/back) by a set distance, or add impulse if you want physics movement. When the button springs back below the threshold, you can reset the boolean so it’s ready for the next press. This keeps detection simple, works with a physically simulated plunger, and scales to your four directions by passing an enum or vector to the cube’s move event.