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

Author Topic: rotate tanslate vs translate rotate  (Read 580 times)

0 Members and 2 Guests are viewing this topic.

smurf

  • Newbie
  • *
  • Posts: 36
    • View Profile
rotate tanslate vs translate rotate
« on: November 14, 2024, 07:18:17 am »
Back when I used to work in raw OpenGL, there was a difference between translating first then rotating, versus rotating first then translating.

In SFML, it seems that it doesnt matter what order you call SetOrigin, SetPosition, SetRotation

So how can I achieve the different behaviors (eg, rotate an object then move it to the right, versus move it to the right then rotate it)

Specifiaclly I an object to orbit my player at a distance, while always pointing toward him.

fallahn

  • Hero Member
  • *****
  • Posts: 507
  • Buns.
    • View Profile
    • Trederia
Re: rotate tanslate vs translate rotate
« Reply #1 on: November 14, 2024, 01:47:20 pm »
SFML Drawables which inherit sf::Transformable call sf::Transformable::getTransform() which always combines the components as Translation->Rotation->Scale. If you want to combine these in a different order you'll need to replace getTransform() with your own function which combines sf::Transform in your custom order. You can then pass the result to the sf::RenderStates for your drawable.