PhysicsBody fixed to point and rotating over an axis

Hey guys!

Im just making a POC with a physicsbody in v.3.2. Basically what I want is to fix an sprite to the middle of the screen and rotating using the strength of the user. Imagine something like a roulette.

How can i make this centre axis so the body interacts with physics world but can’t move from the center?

Any idea?

Thanks in advance!

i believe you can set gravity to (0,0) :

scene->getPhysicsWorld()->setGravity(Vec2(0.0f, 0.0f))

centralize the sprite:

sprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));

then apply Angular Velocity the way you want:

sprite->getPhysicsBody()->setAngularVelocity(speed);

of course, to do this you have to configure Physics in your project.
you can find more in Cocos2d-x documentation and you can watch an excellent tutorial here: Cocos2d-x v3 C++ Tutorial Series (https://www.youtube.com/playlist?list=PLRtjMdoYXLf4od_bOKN3WjAPr7snPXzoe) and Cocos2d-x C++ Physics Tutorial Series (https://www.youtube.com/playlist?list=PLRtjMdoYXLf4dOgNrnQCw1DyIFGUhnVtZ)

Thank you Briebtag!

That wans´t exactly what I was expenting.

Finally I took a very similar approach, but I was asking something like the ecuations to calculate the quantity of movement i have to apply to the sprite.

Anyway, is solved!
Thank you!