Does size matter?

Discussion and feedback on Construct 2

Post » Wed Feb 24, 2016 2:41 am

Stop your dirty thoughts right now! :lol:

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?
ImageImageImage
B
27
S
16
G
80
Posts: 1,014
Reputation: 44,747

Post » 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
135
S
33
G
17
Posts: 1,557
Reputation: 20,717

Post » 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.
ImageImageImage
B
27
S
16
G
80
Posts: 1,014
Reputation: 44,747

Post » 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
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

Post » Wed Feb 24, 2016 10:41 pm

Thanks a lot @R0J0hound! Really good to know that.
ImageImageImage
B
27
S
16
G
80
Posts: 1,014
Reputation: 44,747


Return to Construct 2 General

Who is online

Users browsing this forum: winsonzhong and 7 guests