I work on an importer for my game, it reads xml and then creates box2d bodies for everything.
for example
<polygon vertexCount="3" density="0" friction="0.25" restitution="0.30000000000000004"> <vertice x="6.506500000000001" y="0.4345"/> <vertice x="6.534970527648927" y="0.48385302734375"/> <vertice x="6.478029472351075" y="0.48385302734375"/> </polygon>
The problem is in the exporter Now I am faced with part of the polygon, I need to configure the b2vec2 array before adding vertices and setting their positions.
int count = [[childnode attributeForName:@"vertexCount"] intValue]; b2Vec2 points[count];
but box2d wants dots [5] to be the actual literal number (for example, dots [5] instead of variable dots [number], the error it throws when I have a variable counter in:
Variable length array of non-POD element type 'b2Vec2'
How can i solve this? I tried to make it permanent, but that also does not work (and does not help me, since I need it to be dynamic).
M0rph3v5
source share