Original Post
i am passing the ArrayList Persons to the person class so that each person can check to see if any of the rest of the persons are coliding. its only very basic right now but im stepping through it and i can see that the sphereCenter for the current object is always the same as the sphereCenter for the object the current object is checking its position against. here is the code. i have the hash code comparison here to check if the current person is being compared to itself. dont know if this is the correct solution,
foreach (Person p in Persons)
{
if(this.GetHashCode() == p.GetHashCode())
{
//break;
int d = 90;
Persons.Remove(p);
}
float a = this.sphereCenter.X - p.sphereCenter.X;
float b = this.sphereCenter.Y - p.sphereCenter.Y;
float c = this.sphereCenter.Z - p.sphereCenter.Z;
float distance =(float) Math.Sqrt(a*a + b*b + c*c);
if (distance > this.meshRadius*2)
{
int i =0;//they are not overlapped;
}
if ( distance == this.meshRadius*2)
{
int j = 1;//they are just touching;
}
if(distance < this.meshRadius*2)
{
int k = 2;//they are overlapped
this.sphereCenter.Z +=2;
p.sphereCenter.Z += 0;
}