• Runtimes
  • [UE4] Hit detection

  • تم التحرير
Related Discussions
...

Hey guys

Has anyone thought of a way to do per-pixel hit detection and return the name of the slot that was hit? I'd be happy enough to give a spine actor a set of localised coordinates and get a stack of slots with pixel data under that point if it were possible.

Per-pixel hit detection is somewhat tough and inefficient, especially if you want to access the pixel data and check for alpha. I'm actually not even sure how to get at the pixel data in UE4. The alternative is to either enable physics meshes on the SpineSkeletonRendererComponent, or use the C++ API to either test against bounding box attachments, see SkeletonBounds spine-runtimes/SkeletonBounds.cpp at 3.8. This could be extended to also test against RegionAttachment and MeshAttachment, but that'd again be a bit inefficient, as one would have to calculate the world position vertices of each attachment.

The physics mesh thing should do the trick, it doesn't have to be THAT accurate. I'll check it out, cheers!