I’m having problems positioning a sprite over a circular box2d body. The sprite is kind of orbiting the body’s center point from a distance of around 300 px. For non-circular bodies I don’t have any problems, so I’m confused and I don’t know what to do. Any ideas?
Here’s my code to position stuff:
for (b2Body *body = world->GetBodyList(); body != nullptr; body = body->GetNext()) {
if (body->GetType() != b2BodyType::b2_staticBody && body->GetUserData()) {
Sprite *spr = (Sprite*)body->GetUserData();
spr->setPosition(Vec2(body->GetPosition().x * PTM_RATIO, body->GetPosition().y * PTM_RATIO));
spr->setRotation(-1 * CC_RADIANS_TO_DEGREES(body->GetAngle()));
}
}