Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [Possible bug] SetSpriteShapePolygon() bounding box incorrect in some cases

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 28th Oct 2017 02:28 Edited at: 28th Oct 2017 02:29
Looking at the image you can see some of the shapes do not follow the bounding box. (Concave shapes at the bottom of the image)
If you look at the shape with the dots you can see the points go in a clockwise position (I have coloured the points red=1, yellow=2, green=3, blue=4 etc)
I thought i read somewhere that the points had to be clockwise

Attachments

Login to view attachments
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 28th Oct 2017 09:29
There's no mention of it in the help files but I'm pretty sure that Box2D polygons have to use convex hulls
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 28th Oct 2017 09:40 Edited at: 28th Oct 2017 09:41
How would i implement that? Any ideas?
If that is the case then. How come the convex hulls up the to work?
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 28th Oct 2017 10:26 Edited at: 28th Oct 2017 10:26
Quote: "There's no mention of it in the help files but I'm pretty sure that Box2D polygons have to use convex hulls"
Yep. You will have to split the sprite into multiple concave shapes to accurately follow the corner. Something like this:

Attachments

Login to view attachments
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 28th Oct 2017 21:37
I am still perplexed as to why the convex hulls up the top of the image work?

Login to post a reply

Server time is: 2024-04-25 03:05:34
Your offset time is: 2024-04-25 03:05:34