No announcement yet.

Inverse hit detection?

  • Filter
  • Time
  • Show
Clear All
new posts

    Inverse hit detection?

    I don't think it is available, but if it is that is certainly the solution I'd prefer. I have something bouncing around inside a sphere, and I can make it work with complex line traces using the sphere's mesh. I'd prefer to simplify things by using a collision component which provides a sort of inverse hit event (ie. hit events for when the ray trace stops overlapping the collision component). Unfortunately I am tight on time for this project so I can't thoroughly research how ray traces and collision components interact. I've got about 8 hours in my current milestone sprint to allocate towards this problem.

    My questions are three.
    1) Is there a built in solution I've overlooked which would work with ray tracing? Or a marketplace solution? [I'm not entirely sure what the least ambiguous way to describe this in a search query even is]
    2) Is this sort of reverse collision component possible?
    3) How do ray traces and collision components interact, if this is relevant to solving the problem?

    I'll take whatever experience/help you can give.

    If i understand your problem correctly, to get traces and components to generate hit events you do the following:
    Go in your project settings>collision, create a new object channel called "bouncecollider" with default "ignore".
    Then create a new trace channel called "tracebouncer" with default "ignore".

    Then in your presets further down, double click yoour "bouncecollider" object channel and make sure everything is set to ignore, except Trace Type "tracebouncer", which should be set to "block".

    Then set your collision component collision channel to "bouncecollider".

    Now you can do line traces on the "tracebouncer"-channel, which will only generate a hit event if it hits your collision components mesh, but ignores everything else.

    As far as i know there is no trace to generate hit results when leaving a collision zone, only when entering/hitting it.
    The easiest way for an inverse trace would be to make a mesh that completely and perfectly encapsulates the area/object you want to get a hit result when "leaving" that object, just like a gift wrap paper encapsulates a box. You'd then give the wrap paper that "bouncecollider" object channel and do line traces for it from inside the box. As soon as the trace hits the gift wrap paper, you'll know you are outside your box and can get that as a hit result from the line trace.
    Last edited by StefanHohnwald; 08-13-2018, 06:58 AM.


      I'm a bit confused. I've got the feature working right now without any bounce collider channel, is this to help create the effect of trace exit events?
      Would a regular sphere collision component work for this? as they don't seem to work at all when doing traces from inside them, though I haven't tested with creating a new custom channel. It's just my gut is telling me it shouldn't behave any different in that scenario.


        1. The words you likely are looking for is concave and convex collision shapes.

        2. Or surface or line intersection collision. You only want collision detection during a surface intersection. (Assume everything is hollow)

        3. Depending when you want the event to trigger. Can you not just use "EndOverlap" instead of "BeginOverlap" event?

        Most collision systems are completely built around a convex shape (fully solid with no overhangs). To have a hole in something and detect the 'interiors' of an overhang would fall into the concave shape category. Most systems typically encouraging breaking concave shape into multiple smaller convex shapes.

        However, there are work arounds as you mentioned with tracing and other things but are typically considerably slower than a traditional convex collisions.

        In 2d space its typically easier to do a 'every line collision', or "hollow shapes", where you could just hit detect on a line intersection. But in 3d space it becomes far more complex because most things are technically hollow but collision systems assume they aren't. It gets tricky.
        Last edited by namrog84; 08-21-2018, 05:34 PM.


          Originally posted by namrog84 View Post
          3. Depending when you want the event to trigger. Can you not just use "EndOverlap" instead of "BeginOverlap" event?
          Unfortunately that is far from ideal. I need to use a line trace for a number of reasons, not least of which is because I'm using third party code - of which I have little understanding - and it needs to line trace for the hit-data line traces provide.