I have some basic collision detection and its Precise collision accuracy: 55.000000% and i need 100% and dont know how to do it. I read many sites and dont come up wit any idea. So I woud apriciate some help.
I have some simulation where are some static asteroids and flying asteroids with Vector3 position Vector3 LinerVelocity and radius
I got this:
public float PreciseCollision(WorldObject a, WorldObject b)
{
Vector3 vecs = a.Position + b.Position; // vector between the centers of each sphere
Vector3 vecv = a.LinearVelocity - b.LinearVelocity; // relative velocity between spheres
double q = vecv.Dot(vecs);
if (b.BoundingBox.Intersects(a.BoundingBox) | q >= 0)
return 0;
return float.PositiveInfinity;
}
when is or will be collision its return 0 and its not than float.PositiveInfinity