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

Author Topic: FloatRect.Intersects() - Um... What?...  (Read 2284 times)

0 Members and 1 Guest are viewing this topic.

Lox

  • Newbie
  • *
  • Posts: 14
    • View Profile
FloatRect.Intersects() - Um... What?...
« on: July 21, 2011, 06:08:31 am »
So, I've got  a little dilemma here:

Code: [Select]

mObj = objList[i].bbox;
oObj = objList[q].bbox;
if (mObj.Intersects(oObj,out overlap))
{
       SFMLWin.Draw(Shape.Rectangle(mObj, new Color(0, 255, 255)));
       SFMLWin.Draw(Shape.Rectangle(oObj, new SFML.Graphics.Color(0, 255, 0)));
       SFMLWin.Draw(Shape.Rectangle(overlap,new SFML.Graphics.Color(255,0,0,255)));
}


Which yeilds:



Uhh, what? How do these to intersect, and where did the overlap go?

135

  • Newbie
  • *
  • Posts: 5
    • View Profile
FloatRect.Intersects() - Um... What?...
« Reply #1 on: July 25, 2011, 05:49:19 pm »
May be you can show us your full loop ?

From you code: you draw a cyan rectangle then a green rectangle over then a red rectangle over.
Nothing incompatible with your output if mObj = oObj.

Lox

  • Newbie
  • *
  • Posts: 14
    • View Profile
FloatRect.Intersects() - Um... What?...
« Reply #2 on: August 01, 2011, 09:49:17 pm »
You're right.  I looked into my loop and mObj = oObj at some point.

Thanks :)

 

anything