Suggestion: overlap at range offset

Discussion and feedback on Construct 2

Post » Mon Oct 13, 2014 9:55 am

Hey there,
@Ashley

Just a small feature suggestion: "overlap within range" - checks if an object overlaps with another one within given range offset on X,Y.
e.g. overlaps at x [startRange,endRange]

First I thought that's how Overlap at Offset works, but no. It's only possible by using loops, e.g. repeat 5 times> object overlaps at offset x: loopindex*object.width. If checked like this on every tick tick with multiple objects, the performance drastically drops.
B
45
S
11
G
4
Posts: 517
Reputation: 7,398

Post » Mon Oct 13, 2014 1:35 pm

What's wrong with using loops? Why do you need this? Is it worth the serious performance impact of making far more collision checks than otherwise?
Scirra Founder
B
405
S
238
G
91
Posts: 24,760
Reputation: 197,264

Post » Mon Oct 13, 2014 2:04 pm

I noticed a certain performance drop while doing this looped "overlap at offset" checks, especially was very evident on a mobile browser.
B
45
S
11
G
4
Posts: 517
Reputation: 7,398

Post » Mon Oct 13, 2014 2:17 pm

Making it built-in won't make it magically faster. It still has to do the same number of collision checks.
Scirra Founder
B
405
S
238
G
91
Posts: 24,760
Reputation: 197,264

Post » Mon Oct 13, 2014 3:17 pm

Whats wrong with distance(), or the los behavior for that matter?
Image ImageImage
B
172
S
50
G
188
Posts: 8,504
Reputation: 118,227

Post » Mon Oct 13, 2014 4:47 pm

The effect would be checking for an overlap in a certain rectangle area. You can do this with one collision check by first changing the size and position of the object to cover the area, checking for overlap and then restoring the object size and position to what it was before.

What's your use case?
B
94
S
33
G
122
Posts: 5,443
Reputation: 77,949

Post » Wed Oct 15, 2014 7:40 am

@R0J0hound

Actually I'm trying to implement "collision" vectors of different lengths and directions, to check for possible collisions.
B
45
S
11
G
4
Posts: 517
Reputation: 7,398


Return to Construct 2 General

Who is online

Users browsing this forum: Vortexas and 23 guests