[UE 4.5] OnHitTest no longer called?

I’m trying to upgrade a plugin to version 4.5 but it looks like you guys removed the ability to do non-rectangular hit-testing completely from 4.5 and left a helpful message that this will be re-added in the future?

In the mean-time how should we go about doing non-rectangular pixel-custom hit-testing in 4.5?

Also curious about this, purely for the purposes of using zoids plugin in 4.5

Hey ,

We’re still working on the new hit detection system. In 4.5, there is no way to do what you’re looking for unless you can code it yourself. We’ll implement the new system as soon as it’s ready.

Regards,

Hi, just thought I’d add here that I ran into this today as well. I have a custom widget that is basically two separate rectangles with empty space in between. I reimplemented the OnHitTest call, probably somewhat incorrectly but well enough for my purposes. Hopefully this can be supported for real sometime soon.

Hi Stefan,

What version of the Engine are you currently using, and is it the binary version installed by the Launcher or did you build the Engine from source code?

Also, could you please describe, or provide screenshots of, your widget setup and how you are trying to use it?

Hey , we’re using 4.9 custom binaries. The UI is for a timeline-like system used for choreographing gameplay, ie attacks, buffs, etc.

A screenshot below shows the basic idea, you can lay out tasks on a grid, select them, drag them around, and resize them. They collide with each other as well, so they don’t accidentally overlap. The overall layout in this case is the root widget, with a child widget for every bar.

The “Section1” with the green handles and vertical lines that you see is also a widget as a child of the root widget, and is what I was referring to in my post. The two vertical green lines denote the beginning and end of the section, additional text can also appear in between the start and end handles describing stuff about the section. You can drag the handles to resize the section.

I implemented a SSectionWidget, and at first I was doing additional checks in the various events (OnMouseDown, OnCursorQuery, etc) to test if the cursor was over the left or right handle of the section, and returned FReply::Unhandled() if it wasn’t. This works fine, until two sections overlap, which is allowed. Since the sections are peers, both children of the root widget, the bubble routing policy does not pass any events to the section covered by another one, it always just goes to the parent immediately.

I considered breaking up the SSectionWidget into subwidgets, adding each handle, text, line, individually to the root widget but that made the code very messy. It was much simpler to just add an OnHitTest() to the SectionWidget and only return true if one of the handles was hit, making the center of the section widget transparent to clicks. In FHittestGrid::GetHitIndexFromCellIndex I added a call to OnHitTest() to do the more detailed collision test.

I did some checking on our plans for replacing OnHitTest, and unfortunately it still seems like it may be some time before we get a new implementation in place. In most cases, this can be worked around based on custom knowledge of the underlying geometry. However, your use case is a little more complicated than I had anticipated, so that may not work very well. It may be a good idea to post a new question specifically about the difficulties you are experiencing.