Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SetOrigin changes draw position  (Read 2608 times)

0 Members and 2 Guests are viewing this topic.

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
SetOrigin changes draw position
« on: July 11, 2011, 05:03:58 pm »
Hi

I've been using SFML long enough now to not ask noob questions, you'd have thought....

I've written an animation class, which uses spritesheets. I want to apply some effects to these frames of animation, such as rotation.

When I set the origin of a sprite so that it rotates around the center, it also changes where it's drawn on screen. Why would this be?

I have a feeling I should be using TransformToLocal or TransformToGlobal somewhere along the line.........

Thanks
Ed
SFML 2.1

MorleyDev

  • Full Member
  • ***
  • Posts: 219
  • "It is not enough for code to work."
    • View Profile
    • http://www.morleydev.co.uk/
SetOrigin changes draw position
« Reply #1 on: July 11, 2011, 05:50:42 pm »
I'm pretty sure that's the intended behaviour. The centre of the sprite is used for both translations and rotations.
UnitTest11 - A unit testing library in C++ written to take advantage of C++11.

All code is guilty until proven innocent, unworthy until tested, and pointless without singular and well-defined purpose.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SetOrigin changes draw position
« Reply #2 on: July 11, 2011, 09:57:00 pm »
Indeed. The origin is the origin of all transformations, not just rotations. That's why it's called origin and not center (anymore) ;)
Laurent Gomila - SFML developer