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,393

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
398
S
236
G
88
Posts: 24,428
Reputation: 194,625

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,393

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
398
S
236
G
88
Posts: 24,428
Reputation: 194,625

Post » Mon Oct 13, 2014 3:17 pm

Whats wrong with distance(), or the los behavior for that matter?
Image ImageImage
B
169
S
50
G
174
Posts: 8,327
Reputation: 110,798

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
92
S
32
G
109
Posts: 5,294
Reputation: 70,999

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,393


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 13 guests