Can anyone advise on how this could be done? I just want to spin some circles.
Here is the c++ code, yellowFlower is my sprite. It’s a simple circle object.
auto spriteBody = PhysicsBody::createCircle(yellowFlower->getContentSize().width/2, PhysicsMaterial(0.0f, 0.0f, 0.3f)); yellowFlower->setPhysicsBody(spriteBody); spriteBody->setVelocity(Vec2::ZERO); spriteBody->setAngularVelocity(2); spriteBody->setGravityEnable(false); spriteBody->setDynamic(true); spriteBody->setAngularDamping(0.2f);.0f, 0.3f));
// then later when I want it to spin around it’s center but not move I call:
yellowFlower->getPhysicsBody()->setAngularVelocity(15 + rand() % 10 + 1);
Which makes it spin. I can’t find a way in cocos2d-js to have a physics body that’s in the space but not affected by gravity that I can apply angular velocity too?
If anyone can help that would be great.