What is the correct way to reposition a sprite with a physics body attached?

In Box2d, its quite straightforward - you just call the setTransform to reposition a physics object.

But when using a PhysicsBody attached to a Sprite, I am not sure how to reposition them correctly. Setting the position of the sprite does not change the position of the physics body, and PhysicsBody does not have a setPosition() method.

What am I missing ?

There are physics examples in cpp-tests

I looked at cpp-tests for physics already. It is still unclear - There are examples on using actions, but couldn’t find one which directly sets the position of an already existing physics object attached to sprite.

The closes is setPositionOffset, but its a bit unclear to me.

I only use setPosition In my most heavily utilized physics game but I don’t reposition the physics body a lot. It stays pretty constant with the sprite the whole time it is utilized.

Ok, thanks! I found that it takes some time for physics objects connected via joints to also be repositioned, so wasn’t sure if that was the correct way. I guess I have to reposition those manually as well to avoid lag.

Oh I do position everything manually as a matter of habit.