0
\$\begingroup\$

I was curious on how hit collision works in games. I know there is a simple method that gives every object in a 2D or 3D world a recengular hitbox that makes it easy to detect a collision, but when rotating object, this becomes complocated. Because simple math can't be used to determine whether two rotated lines cross.

To explain my question I will give you an example of what I mean. If you have two lines: (1, 1, -1,-1) and (2,-2,-2, 2). How do you know if these two hit/cross each other and what if you take a circle with radius 1 and center (0, 0), and a line (2, 2,-2,-2). How would you possibly know if these objects hit or cross each other, also keeping in mind that the performance must be good.

\$\endgroup\$
  • 1
    \$\begingroup\$ voted as duplicate as the answer to the underlying question here appears to be that collision engines have a broad phase pass. the part of the question "simple math can't be used to determine whether two rotated lines cross" (the math is very very simple) indicates that kdnooij might also need to be pointed at some texts on collision detection, like Ericson's Real-Time Collision Detection. \$\endgroup\$ – Sean Middleditch Feb 1 '15 at 2:14
  • \$\begingroup\$ I don't think I asked my question very well as I know that checking if two lines cross is very simple. \$\endgroup\$ – kdnooij Feb 1 '15 at 10:38
  • \$\begingroup\$ feel free to edit it to clear up what you mean and if it's a clear answerable question then the question will come out from being on hold. \$\endgroup\$ – Sean Middleditch Feb 1 '15 at 10:46