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

Author Topic: C++ SFML, Circular Movement - Help!  (Read 43566 times)

0 Members and 1 Guest are viewing this topic.

Jycerian

  • Newbie
  • *
  • Posts: 49
  • Weakness of attitude becomes weakness of character
    • View Profile
Re: C++ SFML, Circular Movement - Help!
« Reply #45 on: October 08, 2013, 11:41:33 am »
Anyone?

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: C++ SFML, Circular Movement - Help!
« Reply #46 on: October 08, 2013, 12:34:17 pm »
Maybe get the bounding box of the circle and set it to the same rotation as the rectangle? Then the side of the circle bounding box would be parallel with the nearest rectangle side, and regular rectangle to rectangle algorithms can then be used...I think.

Never done circle to rectangle myself so that's just a guess.  Obviously this won't extend to ellipses.

Tobberoth

  • Guest
Re: C++ SFML, Circular Movement - Help!
« Reply #47 on: October 08, 2013, 06:52:24 pm »
SAT can handle circles, though it's a bit harder than rectangles. It's covered here, though there are unfortunately no implementation details included:

http://www.metanetsoftware.com/technique/tutorialA.html#section3

Jycerian

  • Newbie
  • *
  • Posts: 49
  • Weakness of attitude becomes weakness of character
    • View Profile
Re: C++ SFML, Circular Movement - Help!
« Reply #48 on: October 08, 2013, 07:06:33 pm »
SAT can handle circles, though it's a bit harder than rectangles. It's covered here, though there are unfortunately no implementation details included:

http://www.metanetsoftware.com/technique/tutorialA.html#section3

Yeah I have seen that already, found some stuff about OBB and AABB etc. I shall  read up upon it soon.
http://gamedev.tutsplus.com/tutorials/implementation/create-custom-2d-physics-engine-aabb-circle-impulse-resolution/

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: C++ SFML, Circular Movement - Help!
« Reply #49 on: November 01, 2013, 08:57:42 pm »
I know you are having trouble your collision (and I really like the idea of circular pong). Anyways I wrote a simple version of pong that does what you are trying to achieve. If you want, you can see my version of it [full source code] here.
« Last Edit: November 01, 2013, 09:00:38 pm by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor