General:
Collision is:
Basic Detection:
Basic collision type:
(2d or 3d) circles:
![]() |
![]() |
Recommendations:
(One) Solution:
You can check if the rectangle made up by the path of an object's bounding sphere has collided(Another) Solution:
Could check the line-paths of objects in a frame and not the rectangular path volumes.Tips:
Determining
if arbitrary boxes have collided is very difficult and not
advisable in contrast
to sphere collision.
Key factors to consider:
If you have the velocities of your game objects capped, so that they can
only move a given distance
each frame and the faster objects are
updated first (before collision detection/resolution).
Tips:
(A
third) Solution:
Can reverse compute the positions of both
object's bounding spheres when they collided to where
they were
before. Then you will have a beginning and end point for the
object's path in that
frame. Once you have the paths (as line
segments) you can encompas the bounding spheres volume
along that
path as a rectangular of size correlating to the bounding
sphere/path length and at
an arbitrary orientation.
Often
times phsics engines are made for the general purpose case and as
such don't take
advantage of major shortcuts, so they're not as
fast as something you could make.
Could
do complex polygon collisions, but they are very hard. Convex
polygons are much easier
to do collision for than concave ones.
Even if there are concave polygons being used, they
can be broken
up into multiple (connected) convex polygons.
Problem:
With
discrete time steps there is a problem with collisions on walls, if
something goes fast enough
then it could be ambiguous as to where it
will be at the end of the frame in the provided time step.
Note that
polygons are planes and can be considered as walls depending on your
circumstance.
(One) Solution:
If
something collides with a wall so fast that it appears far away from
the wall such that it’s
noticeable. Then the object should be
put right next to the wall so that it looks like it collided.
(A second) Solution:
When
processing one object at a time, objects can get interleaved within
one another. You can sort
each of the objects from the slower to the
faster moving ones so that no slow-moving object could
get into a
faster moving one. You may want to put a hack into the game to take
into account when
objects are colliding and have the same velocity.