Hi.
I try to rotate my gameplay (checker board and all checkers) around center of board for some grad every onMouseMove event. If checkers are sprites without bodies, all works good. I rotate board (sprite) and checkers around center of board, and checkers are stationary relative to board. To rotate board I use board:setRotation(board:getRotation() + my_angle). To rotate checkers I calculate new (x, y) and use sprite:setPosition(x, y).
But if checkers are sprites with bodies (box2d) and I try to rotate board and checkers I have problem. If I rotate slowly, checkers are stationary relative to board. But if I rotate quickly, checkers are not stationary relative to board (checkers rotate slowly then board). To rotate checkers I calculate new (x, y) and use sprite.body:setPosition(x, y).
I tried to use body for board. To rotate board I use board.body:setAngle(board.body:getAngle() + my_angle). It's not work too.
May anybody help me?
Comments
I may not understand correctly but, b2.Body:setAngle/b2.Body:getAngle works in radians but Sprite:setRotation/Sprite:getRotation works in degrees. Is this your problem?
(btw, although the function b2.Body:setAngle exists, it's missing on reference manual. I'm updating it right now)
Thanx.
I've attached my source code.
Chapay.rar work good.
In Chapay1.rar I use box2d and get problem.