Hello everyone, I am trying to create an object-dragging system in Unreal Engine 5 using Blueprints (similar to moving papers or documents across a table), but I am encountering an issue with boundary constraints. Here is what I want to achieve: The player should be able to drag a 3D object across a table using the mouse. The object’s movement must be restricted within the boundaries of an invisible box (such as a “trigger box” or defined limits). If the player attempts to drag the mouse outside this invisible boundary, the object should remain fixed at the edge; however, when pushed against the boundary, it should rise upwards along the Z-axis (increasing its height). How can I accomplish this?
On drag start, trace the cursor to the table plane and store the hit point plus the actor’s offset. Each tick, trace again, convert the hit point to the table’s local space, and clamp X/Y to the usable bounds (subtract the object’s half-size so its edge stays inside). Set the actor location from that clamped point. If you want it to rise at an edge, compute the amount outside the bounds before clamping and add that excess to Z with a chosen scale; a Box Collision overlap can provide the same bounds.