Does rectangular 4 point polygon collider = box collider?

Discussion and feedback on Construct 2

Post » Fri Dec 12, 2014 4:13 am

In regards to setting up a collision polygon, does the engine always use polygon/polygon collision checks? Does the engine optimize the collision algorithm if both objects have perfect rectangles for collision shape (i.e. 4 points perfectly rectangular)?

Also will there ever be support for circle/circle or circle/rectangle collision support?

The reason why i ask is because I know that doing rectangle and circle collision checks are much simpler computationally than polygon collision checks. So I'm wondering if I can optimize my game by using only rectangles for colllision, or is that just wasting time?

Thanks!
B
10
S
3
G
2
Posts: 8
Reputation: 1,548

Post » Fri Dec 12, 2014 12:58 pm

C2 only uses collisions polygons if the bounding boxes are overllaping already (the bounding box is the smallest non rotated rectangle that the object can fit in, if the object is rotated, the bounding box does not rotate), this is part of the reason why you cannot set a collision polygon outside if the object.

however polygons checks, when used, can be really time consuming but I would recommand: use a simple shape that just correspond to your object well. I do not think that, unless you have a very large number of poly checks in the debugger, changing the'polygons would help.

also, for all the behaviors that use collisions, and on your events (under some conditions), collision cells are used: on a big environnement, they just makes objects completely ignore collisions as, well, there will not be collisions between them anyway.

If you have perf. problems, try to see where that problem is comming from, if it is the collisions, then maybe you just need to check less collisions, accordingly to the design of your game.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Fri Dec 12, 2014 3:46 pm

Thanks for the reply Aphrodite,

I will just not worry about it until I detect performance issues.
B
10
S
3
G
2
Posts: 8
Reputation: 1,548


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 1 guest