Rotation tween around arbitary point

Recommended Posts



I'm new to Phaser and are trying to make a simple game in which you can rotate the game board (90 degree steps). on the board there's a a few blocks that should be rotated along with the board. To rotate the board and the blocks around their center anchor points work well with tweens but I haven't managed to get the blocks to rotate nicely along with the board as described in the picture.




So far my best solution is to tween the block positions but that doesn't look very good.

var goal = new Phaser.Point(this._block.x, this._block.y);goal.rotate(this._center.x, this._center.y, -90, true);this.add.tween(this._block).to({x: goal.x, y: goal.y}, 750, Phaser.Easing.Linear.None, true, 100);


I guess i could set the anchor point of each block to the center and then rotate, but how do I translate the board center position to the anchor point format? I could calculate a few points in an arc and interpolate between them. I also heard about tweening in bezier curves. 


Al this sounds like a bit of overkill, there must be an easier way? My first 10 Google pages are all purple  :unsure:


Share this post

Link to post
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.