1
Support / collision detection
« on: January 27, 2009, 02:47:06 pm »
Got a new problem .
If I understand checkForCollisionSpherical correct; when there is collision, checkForCollisionSpherical returns a vector different from the translation vector you entered with the check (the correct new translation)
I tried to apply this to my code :
m_ClientObjects is a Vector<Object3D>
all the Object3D in the vector have
the object where I'm testing the collision for has
But this snippet of code doesn't work, the SimpleVectors a and temp are always the same... so there is always collision ?? (eventhough there isn't)
What am I doing wrong ?
If I understand checkForCollisionSpherical correct; when there is collision, checkForCollisionSpherical returns a vector different from the translation vector you entered with the check (the correct new translation)
I tried to apply this to my code :
m_ClientObjects is a Vector<Object3D>
all the Object3D in the vector have
Code: [Select]
object.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
the object where I'm testing the collision for has
Code: [Select]
object.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS | Object3D.COLLISION_CHECK_SELF);
Code: [Select]
for (int i=0;i<STATE.m_ClientObjects.size();++i)
{
SimpleVector temp= STATE.m_ClientObjects.elementAt(i).checkForCollisionSpherical(a, 128);
if (temp != a)
{
a = temp;
System.out.println("New translation: " + temp);
}
}
But this snippet of code doesn't work, the SimpleVectors a and temp are always the same... so there is always collision ?? (eventhough there isn't)
What am I doing wrong ?