caymanbruce Posted June 26, 2017 Share Posted June 26, 2017 I try to rotate a bigger circle which contains a smaller circle. but I want the smaller circle inside the big circle moves independently at the same time when they rotate together to the same direction. How can I do this? For example when I rotate the big one to the right the smaller circle first moves to right a little bit then goes back to its original position in the big circle. When the big circle arrives at the new rotation the smaller circle is also rotated to the new rotation with the same relative position in the big circle. I have set their anchors both to 0.5. This seems easy but first the sprites don't rotate at the same center point. So when I rotate the big circle the smaller circle won't rotate with it. It will only stays at its own position and rotate at its own center point. If I want it to rotate with the big circle I have to manually change its positions. And that is what causes more trouble. The position doesn't follow the rule newX = (small.x - big.x) * Math.cos(rotation) and newY = (small.y - big.y) * Math.sin(rotation). It will rotate to the opposite direction. I don't know what is happening. If I put the two sprites into a container I can't set the container's anchor so I can't rotate them together at their center. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.