Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
rotate sprite and body - Gideros Forum

rotate sprite and body

AlexRuAlexRu Member
edited February 2012 in General questions
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

Sign In or Register to comment.