# Does size matter?

Discussion and feedback on Construct 2

### » Wed Feb 24, 2016 2:41 am

Stop your dirty thoughts right now!

Now seriously... to the topic. I'm wondering how the collision algorytm works from the perspective of collision bounding box.

1. Does size of the collision elements/bounding boxes matter? And if so then is it faster when the object is bigger or smaller?

2. Does C2 calculate collisions faster if bounding box is rectangualr (4 points, 90 degrees) shape rather then some fancy (many points) shape?
B
38
S
23
G
89
Posts: 1,086
Reputation: 50,398

### » Wed Feb 24, 2016 5:39 am

BackendFreak wrote:1. Does size of the collision elements/bounding boxes matter? And if so then is it faster when the object is bigger or smaller?

2. Does C2 calculate collisions faster if bounding box is rectangualr (4 points, 90 degrees) shape rather then some fancy (many points) shape?

+1 for these questions.
B
141
S
34
G
17
Posts: 1,561
Reputation: 21,065

### » Wed Feb 24, 2016 4:42 pm

@Ashley could you say something about that? Collisions are one of the things which take the most CPU. It would be really nice to know those details.
B
38
S
23
G
89
Posts: 1,086
Reputation: 50,398

### » Wed Feb 24, 2016 10:17 pm

1.
No it doesn't, either is just as fast.

2.
First C2 filters down the possible collisions with collision cells:
https://www.scirra.com/blog/ashley/6/co ... on-in-r155

Next it sees if two object's bounding boxes overlap, and then it sees if the collision polygons overlap.
Basically it goes from fastest check to slowest and stops further checks if objects can't be overlapping. The more collision poly points the slower a check will be.
B
97
S
36
G
131
Posts: 5,514
Reputation: 83,466

### » Wed Feb 24, 2016 10:41 pm

Thanks a lot @R0J0hound! Really good to know that.
B
38
S
23
G
89
Posts: 1,086
Reputation: 50,398