rotation - Rotating body around a point Box2D Cocos2d -


i have problem when rotating triangular image radar detecting enemies.

b2body *body; ccsprite *actor;    if (b->gettype() == b2_kinematicbody && myactor == [loader spritewithuniquename:@"radar."]){          radar = b;         radarsprite = myactor;     } 

it kinematic body made levelhelper, , want rotate it. need rotate around static point, , repeat movement backwards. since body , not sprite, don't know how make rotate around top point.

i have idea, i'm not sure. if rotate ccsprite , move body sprite.position? possible?

thank much

here's how update position , rotation of box2d bodies acording theirs sprites:

// box2d updates. // set position of b2bodies according sprites. _world->step(delta, 10, 10); for(b2body *b = _world->getbodylist(); b; b=b->getnext()) {     if (b->getuserdata() != null)     {         gameobject *sprite = (gameobject *)b->getuserdata();         b2vec2 b2position = b2vec2(sprite.position.x/ptm_ratio,                                    sprite.position.y/ptm_ratio);          float32 b2angle = -1 * cc_degrees_to_radians(sprite.rotation);         b->settransform(b2position, b2angle);     } } 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -