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

Author Topic: Sprite Rotation + Collision Check = Question  (Read 3615 times)

0 Members and 1 Guest are viewing this topic.

coolhome

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Sprite Rotation + Collision Check = Question
« on: July 17, 2009, 04:55:14 am »
Hello. I got a question that I've ran into in my game development. Lets say we have a object thats 200x100. We set the center to the exact middle and rotate it. Now when we check if the player box intersects with the odd rotating shape how do we do that correctly?

Sinces its rotating sf::IntRect doesn't have a rotate feature.

or am I completey wrong and off track here :P

Thanks,
Preston Alvarado
CoderZilla - Everything Programming

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Sprite Rotation + Collision Check = Question
« Reply #1 on: July 17, 2009, 08:40:04 am »
You have to use the separate axis algorithm. It can find intersections between arbitrary polygons, so it may be slightly simpler for two 2D rectangles.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Sprite Rotation + Collision Check = Question
« Reply #2 on: July 17, 2009, 01:33:39 pm »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything