Sign in to follow this  
nickanastasov

Phaser - Rotate one sprite around another sprite

Recommended Posts

Hello developers,

I want to ask you a question ( it could be silly but I can't find anything that works in the forum or other articles ). I want to rotate one line around a circle and I will attach an image to understand me perfectly what i mean. So i searched a lot about rotation of sprites with Phaser but I can't find a working example or a working function that will do what I want. I'm pretty sure my thing is not a big deal so it should be available to be done.

 

I hope you can help me,

Nick.

 

post-14185-0-57674300-1429367291_thumb.j

Share this post


Link to post
Share on other sites

Hi,

 

I think you should change the pivot position of your rotating object so that the pivot and the center of your circle will be the same point and then, rotate this object (the line on your picture).

 

You can use :

yourDisplayObject.pivot.set(yourX, yourY);

(Doc : http://www.goodboydigital.com/pixijs/docs/classes/DisplayObject.html#property_pivot )

 

to set the pivot coordinates.

 

Lauro.

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.

Guest
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.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.