Placing b2body(with sprite) at some angle and move it along with the sprite in cocos2dx | Techbirds
Step1:Making the sprite at the angle where we want to place the b2body:Assuming rX and rY are the scaling factors CCSprite *rect=CCSprite::create(“rect.png”); rect->setScaleX(rX); rect->setScaleY(rY); rect->setRotation(-7); rect->setPosition(ccp((winSize.width*0.5)/PTM_RATIO, (winSize.height*0.5)/PTM_RATIO)); this->addChild(rect,1); CCSprite *rect=CCSprite::create(“rect.png”); rect->setScaleX(rX); rect->setScaleY(rY); rect->setRotation(-7); rect->setPosition(ccp((winSize.width*0.5)/PTM_RATIO, (winSize.height*0.5)/PTM_RATIO)); this->addChild(rect,1); Step2:Then make the corresponding b2body.Here i am loading the body from the physics editor,therefore adding it using the GB2ShapeCache