It's also possible that you generated an "inside-out" triangle. Box2D expects polygon vertices in counter-clockwise order.
Maximum vertex count Polygon
Bugs, Requests, and FeedbackI had to increase vertices count for one project.
You indeed need to change the block allocator.
Here is what i did to increase from 8 to 24, so i suppose you can do same if you want more.
In b2BlockAllocator.h :
change:
by:
in b2BlockAllocator.cpp
Then polygon works for 24 vertices. In your case you might also need to increase the chunk size.
You indeed need to change the block allocator.
Here is what i did to increase from 8 to 24, so i suppose you can do same if you want more.
In b2BlockAllocator.h :
change:
Code:
const int32 b2_maxBlockSize = 640;
const int32 b2_blockSizes = 14;
const int32 b2_blockSizes = 14;
by:
Code:
const int32 b2_maxBlockSize = 1280;
const int32 b2_blockSizes = 15;
const int32 b2_blockSizes = 15;
in b2BlockAllocator.cpp
Code:
int32 b2BlockAllocator::s_blockSizes[b2_blockSizes] =
{
16, // 0
32, // 1
64, // 2
96, // 3
128, // 4
160, // 5
192, // 6
224, // 7
256, // 8
320, // 9
384, // 10
448, // 11
512, // 12
640, // 13
1280 // 14 --> Here i added the new block in the array
};
{
16, // 0
32, // 1
64, // 2
96, // 3
128, // 4
160, // 5
192, // 6
224, // 7
256, // 8
320, // 9
384, // 10
448, // 11
512, // 12
640, // 13
1280 // 14 --> Here i added the new block in the array
};
Then polygon works for 24 vertices. In your case you might also need to increase the chunk size.
Original thread: https://box2d.org/forum/viewtopic.php?t=4678