Jump to content

Group anchor/pivot?


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

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.
  • Create New...