[Suggestion] 'Point Overlaps Object' Condition

Discussion and feedback on Construct 2

Post » Fri Jun 28, 2013 2:02 am

There doesn't seem to be a condition in Construct 2's Sprite object that tests if a point (x,y) lies within the sprite's collision polygon. I feel there are plenty of reasons why such a condition should exist natively in C2:
  1. It provides fundamental information about an object's collision polygon that can aid in writing advanced custom collision detection code. Consider objects that climb slopes along their bottom-center image point but retain the information needed to use their bounding polygon when testing for collisions near edges, where their extremities must be off the edge if they are to fall. Or perhaps consider a scenario where you want to test if one object is fully contained within another.

  2. It provides a neat, reusable method for fetching information of this nature. Without this condition in C2, I would have to use a single pixel sprite. If I were to use this sprite and position it to the point in question each time I were checking for overlap, I would have to repeat this series of events for every object in question. It would be difficult to see at a glance what point I'm comparing against because those values would be overshadowed by the logic of the algorithm that involves positioning the sprite, etc. Functions won't work because then I would have to pass a parameter that refers to the object whose collision polygon I'm testing against. Let's say I pass it's IID. I don't see a way to Pick an object with an IID and test for overlap with it. I could use Families and UIDs, but that still makes it far more complex than it needs to be.

  3. Something as intricate and precise as a collision polygon could be used in countless ways, but we are presently only given one limited usage of it: to check if two objects overlap. The power and flexibility of defining a collision polygon to sub-pixel precision seems wasteful when only one essential use is allowed. More open access to the collision polygon (by way of checking if a point lies within it) would significantly increase the programming possibilities available to the game developer with very little increase in software complexity.
All in all, I think this would be a great addition to C2. I apologize if there are already simple approaches to finding whether a point overlaps an object, but I asked in the 'How Do I?' forum and no one seemed to know of any.

Thanks for considering my request!Dalal2013-06-28 02:28:04
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Fri Jun 28, 2013 9:14 am


check out this post.

http://www.scirra.com/forum/precise-collision-for-static-sprites_topic67798.html?KW=single+point

B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Fri Jun 28, 2013 12:42 pm

You're in luck - I already added point collision tests for r137.
Scirra Founder
B
386
S
229
G
87
Posts: 24,207
Reputation: 191,672

Post » Fri Jun 28, 2013 6:32 pm

Awesome! Great timing. I'm looking forward to the next release. Thanks Ashley!
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Sun Jul 28, 2013 7:31 pm

Hi Ashley. Thanks for all the work you've done helping develop Construct. Is there any possibility we could see a feature implemented soon that lets you check the point at which the extremities of two objects collide? I am currently developing a game which requires me to return the x,y position of the place at which two physics objects touch/collide, both of which have complex bounding boxes made up of several collision points.

I can envision countless useful ways such a feature could be implemented into people's games. For mine I need to know the point of collision so that my character, which is a ball, can be made to 'jump' off of curved surfaces at a 90degree angle to them, but without knowing the point of collision it is impossible for me to assign a physics impulse on the ball away from the point of collision.

Be the answer 'yay' or 'nay' I would greatly appreciate hearing back from you on the matter. Thanks a bunch!

Tom.
B
6
Posts: 14
Reputation: 380

Post » Sun Jul 28, 2013 7:44 pm

All too coincidental. I came to Scirra just now to search "check collision with point", and while I was typing that, it caught my eye that the most recent post in the General forum (seeing this from the main forum landing page) was in this thread.

Ashley, you say that you've implemented it into r137, great! When is that due to be released? Wait, just checked the release page, and wow it looks like it's out. I'm gonna give it a shot!
B
11
S
2
Posts: 54
Reputation: 805

Post » Mon Jul 29, 2013 3:06 pm

I see in the changelog for r139 (specifically r137:
display collision polygons in layout view;

How is this enabled, or where do we set the option to see these in layout view? Is it possible for troubleshooting & debugging to actually see it in the rendered game as well? Obviously I wouldn't leave it on for release, but I'm experiencing some collision issues I'd like to troubleshoot, and seeing the collision mask at runtime would be beneficial. But at the very least, how do I enable it in the layout view?
B
14
S
6
G
1
Posts: 143
Reputation: 1,795

Post » Mon Jul 29, 2013 3:13 pm

@wizaerd under view
there is checkbox for collision polys

edit
don't think option to view during runtime tho sorryDrGreenThumbCAN2013-07-29 15:13:49
B
40
S
12
G
6
Posts: 136
Reputation: 6,347

Post » Mon Jul 29, 2013 3:17 pm

Thanx Dr... I was just coming here to say I had found it.
B
14
S
6
G
1
Posts: 143
Reputation: 1,795

Post » Mon Jul 29, 2013 4:40 pm

@wizaerd
well glad to know you found it :)
B
40
S
12
G
6
Posts: 136
Reputation: 6,347

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests