[Solved]How do I make custom collision detection using BBox?

Get help using Construct 2

Post » Mon May 16, 2016 7:15 pm

I'm trying to Pick objects that has overlapping BBoxes. So I would guess Object1.BBoxRight < Object2.BBoxLeft would detect if they were intersecting, but would also pick every other instance of Object1 left of Object2. How do I pick only the intersecting instances using BBox?
Last edited by tunepunk on Mon May 16, 2016 8:06 pm, edited 1 time in total.
Follow my progress on Twitter
or in this thread Archer Devlog
B
40
S
17
G
17
Posts: 980
Reputation: 12,632

Post » Mon May 16, 2016 7:30 pm

Found this c++ code that might solve it.

if (RectA.Left < RectB.Right && RectA.Right > RectB.Left &&
RectA.Top < RectB.Bottom && RectA.Bottom > RectB.Top )

Just hope i can translate it to something usable in C2
Follow my progress on Twitter
or in this thread Archer Devlog
B
40
S
17
G
17
Posts: 980
Reputation: 12,632

Post » Mon May 16, 2016 8:03 pm

Solved it. Sharing here in case someone else needs to detect collisions based on the BBox. Great for example on isometric games och if you need to detect collisions other than the collision polygon.

Image
Follow my progress on Twitter
or in this thread Archer Devlog
B
40
S
17
G
17
Posts: 980
Reputation: 12,632


Return to How do I....?

Who is online

Users browsing this forum: beguinner, brunopalermo, Lancifer, TheCreepy12, Yahoo [Bot] and 23 guests