c++sfml

What's the difference between getLocalBounds and getGlobalBounds in sfml c++?


I was making a collision detection for my objects, and was just wondering why I should use GlobalBounds instead of LocalBounds? or does it not matter which function I use?


Solution

  • In simple terms: global bounds = local bounds + transformations and since you most of the time want to deal with the transformed position, scale or rotation, the global bounds become more useful than the local ones.
    Of course there are always use cases, where local bounds can be useful, such as getting the original size.