cocos2d iphone - box2d collision with curves -


hi im working on ipad app using cocos2d objective c , box2d. question in relation box2d , collisions curves. have circles within larger circle arena. smaller circles collide each other fine want know how make them collide edges of larger arena circle correctly dont leave arena , bounce in. ideas on how approach problem great cheers

ok got working im not sure if correct way it

int sides = 50;      float x_coordprev=([arena contentsize].width/2)*cos(0.0);     float y_coordprev=([arena contentsize].width/2)*sin(0.0);     x_coordprev += arena.position.x;     y_coordprev += arena.position.y;      b2bodydef arenabodydef;     arenabodydef.position.set(0,0);     b2body *arenabody = _world->createbody(&arenabodydef);     b2polygonshape arenabox;     b2fixturedef arenashapedef;     arenashapedef.shape = &arenabox;      for(float angle=0.0f;angle<(2*m_pi);angle+=(2*m_pi)/sides){         float x_coord=([arena contentsize].width/2-10)*cos(angle);         float y_coord=([arena contentsize].width/2-10)*sin(angle);         x_coord += arena.position.x;         y_coord += arena.position.y;         arenabox.setasedge(b2vec2(x_coordprev/ptm_ratio,y_coordprev/ptm_ratio),b2vec2( x_coord/ptm_ratio,y_coord/ptm_ratio ));         arenabody->createfixture(&arenashapedef);         x_coordprev = x_coord;         y_coordprev = y_coord;     } 

this creates circle out of 50 sides , appears doing want. if has better way please let me know ty


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -