Moving objects colliding when using unalligned collision avoidance (steering)

Posted by James Bedford on Game Development See other posts from Game Development or by James Bedford
Published on 2011-03-16T21:53:10Z Indexed on 2011/03/17 0:20 UTC
Read the original article Hit count: 253

I'm having trouble with unaligned collision avoidance for what I think is a rare case. I have set two objects to move towards each other but with a slight offset, so one of the objects is moving slightly upwards, and one of the objects is moving slightly downwards.

In my unaligned collision avoidance steering algorithm I'm finding the points on the object's forward line and the other object's forward line where these two lines are the closest. If these closest points are within a collision avoidance distance, and if the distance between them is smaller than the two radii of the two object's bounding spheres, then the objects should steer away in the appropriate direction.

The problem is that for my case, the closest points on the lines are calculated to be really far away from the actual collision point. This is because the two forward lines for each object are moving away from each other as the objects pass. The problem is that because of this, no steering takes place, and the two objects partially collide.

Screenshot of object forward lines.

Does anyone have any suggestions as to how I can correctly calculate the point of collision? Perhaps by somehow taking into account the size of the two objects?

© Game Development or respective owner

Related posts about collision-detection

Related posts about vector