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

Author Topic: Collision Detection Complexities  (Read 1461 times)

0 Members and 1 Guest are viewing this topic.

KasHKoW

  • Newbie
  • *
  • Posts: 41
    • View Profile
Collision Detection Complexities
« on: September 25, 2011, 06:04:40 am »
How would I check and see if a small object is in a box as it moves around randomly?

The box or sf::Shape::Rectangle doesn't give 4 coordinates to check to see if the object is inbetween the box.
e.g.
Code: [Select]

if( x > 40.0f && < 80.0f)
    if ( x > 30.0f < 10.0f)
           //...x is in between the box


I've decided to make a somewhat abstract body or frame around the actual object that will work as a method for checking to see it. The question that arises now is how do I update this box with the objects movement. Where do I get this data that's hard to get...? haha

I haven't looked inside the actual sfml code yet to see how you come up with the actual body when making an sf::Shape::Rectangle(because it only takes in two points) which I understand how it works but seeing how it's done would be nice... and possibly give insight on another problem a little more advanced then this...

Thanks.

 

anything