R
Rick
Hi,
I'm trying to detect collision with an object in 2D space traveling
towards a line (draw using Line2D). the object has vertices x1, y1,
width, height. when I try doing:
Line2D line = new Line2D.Double(l_x1, l_y1, l_x2, l_y2);
if (line.intersects(x1, y1, x1+width, y1+height)) {
System.out.println("Collision!");
}
This isn't working properly. "Collision!" get's printed way too early
even when the object is quite away from the line. The line is something
like:
\
\
\
\
O \
\
Where "O" is the object. Can anyone explain what's happening? Thanks
Rick
I'm trying to detect collision with an object in 2D space traveling
towards a line (draw using Line2D). the object has vertices x1, y1,
width, height. when I try doing:
Line2D line = new Line2D.Double(l_x1, l_y1, l_x2, l_y2);
if (line.intersects(x1, y1, x1+width, y1+height)) {
System.out.println("Collision!");
}
This isn't working properly. "Collision!" get's printed way too early
even when the object is quite away from the line. The line is something
like:
\
\
\
\
O \
\
Where "O" is the object. Can anyone explain what's happening? Thanks
Rick