point of collision

This forum is currently in read-only mode.
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • this would be usefull for a few things and itd be a nice little addition

    what this would do is first you have an event, like i dunno,sprite colides with sprite2, and then if you use this event you could add to a formula (retrieve point of collision x and one for y too) this would return to you the point at which to objects first touched, so lets say

    | _____

    2+ / /_____

    | / / \ 1+ / / \ | ````` ``````

    ---+---+---+---+---+---+

    0 1 2 3 4 5 6

    we would get the coordinate 3 for X and 2 for Y (i suck at ASCII shutup lol)

  • I believe this has been requested before, and there were a couple of problems with it that arose during the discussion.

    1. When two sprites overlap for the first time, there could be several pixels that are overlapping, so how would you tell which point to return?

    2. A complex sprite might overlap another sprite at more than one point (which I guess is just a variation of 1).

    By the way, you should wrap your ascii in code tags, otherwise it's all squished up and makes no sense.

  • couldn't you just add a parameter like find point of collision closest to (x,y)

  • Finding the average of where the pixels overlap might be good in some situations, but would yield strange results in others. For instance:

    <img src="http://i36.tinypic.com/2mg7afo.jpg">

    Here the collision would register in empty space as the average of the two actual collision points. It would be very difficult I think to develop a system where Construct could accurately decide where to register the collision in a way that makes sense to the user, and even more difficult to make it so both areas that are overlapping register separate collisions.

    As a workaround you set up image points around your object in certain key areas and test for "sprite1 collides with point (sprite2(imagepointx, imagepointy)) ." That might do the trick, depending on how many image points you set up.

  • aww well, guess its something which has multiple outcomes sometimes, just like an IK chain, adding detectors would defeat the purpose, as it supposed to return an exact point not set points

    and no i will not put little detectors everywhere, that be pretty annoying lol

  • and no i will not put little detectors everywhere, that be pretty annoying lol

    Tell me about it

    But really, I think that would be the only way, at least in Construct. I've seen it in other stuff though, like

    Subscribe to Construct videos now

    , where blood decals position themselves on sprites in the correct spot where bullets overlap and whatever. But that's a totally custom engine built from scratch, and the bullets are likely just 1x1 hitboxes or even vector lines that intersect a polygon face or something. I'm not sure exactly how it works.

  • It's also difficult to determine the point of collision efficiently - the collision engine checks 64 pixels at a time for better performance, which also means it can only tell to within 64 pixels where a collision happened anyway. Having it any more accurate would be a lot slower, and as deadeye mentions, highly problematic anyway.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • > and no i will not put little detectors everywhere, that be pretty annoying lol

    >

    Tell me about it

    But really, I think that would be the only way, at least in Construct. I've seen it in other stuff though, like

    Subscribe to Construct videos now

    , where blood decals position themselves on sprites in the correct spot where bullets overlap and whatever. But that's a totally custom engine built from scratch, and the bullets are likely just 1x1 hitboxes or even vector lines that intersect a polygon face or something. I'm not sure exactly how it works.

    ahh, youre methodology has just led me to solving how to do this using something which i already figured out

    ill just save relative coords to the object i want to know the position for and that will retrieve what i want, i shoulda thought of that b4hand

  • Could you further explain that? I'm also interested in this, but i didn't understand what you said at all...

  • look for my thread of "target point" or something like that, should clear things up

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)