Jump to content

Phaser - Rotate one sprite around another sprite


nickanastasov
 Share

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

Link to comment
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.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...