point of collision

New releases and general discussions.

Post » Fri Oct 03, 2008 9:30 pm

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)
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Fri Oct 03, 2008 10:07 pm

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).

[size=50:2pwvtz5z]By the way, you should wrap your ascii in code tags, otherwise it's all squished up and makes no sense. :wink: [/size:2pwvtz5z]
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Oct 04, 2008 8:26 pm

couldn't you just add a parameter like find point of collision closest to (x,y)
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Sat Oct 04, 2008 11:05 pm

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



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.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Oct 04, 2008 11:10 pm

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
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Sat Oct 04, 2008 11:23 pm

[quote="QuaziGNRLnose":207dam1x]and no i will not put little detectors everywhere, that be pretty annoying lol[/quote:207dam1x]

Tell me about it :D

But really, I think that would be the only way, at least in Construct. I've seen it in other stuff though, like Link Dead, 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.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Oct 05, 2008 12:31 am

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Sun Oct 05, 2008 3:06 am

[quote="deadeye":3tu0u3q3][quote="QuaziGNRLnose":3tu0u3q3]and no i will not put little detectors everywhere, that be pretty annoying lol[/quote:3tu0u3q3]

Tell me about it :D

But really, I think that would be the only way, at least in Construct. I've seen it in other stuff though, like Link Dead, 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.[/quote:3tu0u3q3]

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
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Thu Oct 30, 2008 12:31 am

Could you further explain that? I'm also interested in this, but i didn't understand what you said at all...
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Sat Nov 01, 2008 4:43 pm

look for my thread of "target point" or something like that, should clear things up
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 0 guests