How do I rotate an anchored sprite around its center?

0 favourites
  • 4 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • My pivot is in the center on I have set the anchoring to the top of the screen however it seems that when I do this the sprite also bounces up and down.

    I have tried normally rotating, using the rotate behaviour and with both sprites and SWFs but I get the same result every time.

    When I run a preview of the animation in the editor it looks fine so presumably the anchoring is causing this?!?

    I should also add that changing the achor settings make the objects behave even stranger..in some cases pulling a stretching the image and sometime it looks like its has 3d with perspective and mesh warping...but this is just a sprite without any mesh.

    I would expect this sprite just to simply rotate around its origin no matter what the anchoring is set to..

  • The Anchor behavior keeps objects positioned according to the edges of their bounding boxes. Rotating an object enlarges the bounding box, and so the Anchor behavior will adjust the position accordingly, which won't keep it centered.

    It should be straightforward to work around though: you could anchor an invisible non-rotating object, and pin the rotating object on top of that. Or just don't use the Anchor behavior, and position the object with events according to the system viewport expressions.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The only way I could think to do this in the end was to create a parent that had the anchor behaviour and then to just rotate the child which is attached to the parent at the start via the add child command. This method seems to work but I still don't know why the original method did not..

  • The Anchor behavior keeps objects positioned according to the edges of their bounding boxes. Rotating an object enlarges the bounding box, and so the Anchor behavior will adjust the position accordingly, which won't keep it centered.

    It should be straightforward to work around though: you could anchor an invisible non-rotating object, and pin the rotating object on top of that. Or just don't use the Anchor behavior, and position the object with events according to the system viewport expressions.

    Gotcha. Thanks

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)