Jump to content

Group anchor/pivot?


stnever
 Share

Recommended Posts

Hello, I have a group with 2 sprites, one on the "north" side and one on the "south" side. I want to rotate the whole group around its center, so that the "north" sprite ends up at the south side, upside-down.

 

My understanding is that, for a standalone sprite, the "angle" and "rotation" properties are relative to the sprite's "anchor" point. So if I wanted to rotate only one sprite, I would set its anchor to (.5, .5) and angle to 180.

 

But a Group does not seem to have a "anchor" property. Instead, it has a "pivot" property, but it doesn't seem to behave like a sprite's anchor -- setting it to (.5, .5) doesn't make it rotate in-place...

 

Is there something obvious I'm missing?

 

Sample fiddle: http://jsfiddle.net/b7ptU/2/

 

(the fiddle uses 1.1.5, but I'm seeing the same behaviour on 1.1.6)

 

Thanks in advance!

Link to comment
Share on other sites

Groups are based and rotate around 0,0 by default and children are positioned relative to that. So if you placed a sprite at say Group.x - 100 and another at Group.x + 100 you'd have one on each side, and rotating the group would rotate them properly.

 

Groups don't have anchors because they don't have textures. Anchor is for texture alignment. Think of Pivot as being like the registration point, so it's given in pixels, not fractions.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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