class MyListener implements CollisionListener{
@Override
public void collision(CollisionEvent event) {
int[] ids = event.getPolygonIDs();
Object3D[] objs = event.getTargets();
}
@Override
public boolean requiresPolygonIDs() {
// TODO Auto-generated method stub
return true;
}
}
//Assume a car collide with 2 walls;
public void test(){
MyListener listener = new MyListener();
Object3D wall_1;
wall_1.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
Object3D wall_2;
wall_2.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
Object3D car;
car.setCollisionMode(Object3D.COLLISION_CHECK_SELF);
wall_1.addCollisionListener(listener);
wall_2.addCollisionListener(listener);
car.checkForCollisionEllipsoid(translation, ellipsoid, recursionDepth);
}
When the car collides with both of wall_1 and wall_2 at the same time, the objs = event.getTargets() will contain wall_1 and wall_2, and the ids = event.getPolygonIDs() will contain some polygonIDs of wall_1 and some polygonIDs of wall_2, right?
If that's correct, how could i judge which polygonIDs belongs to wall_1?(and which belongs to wall_2)
Or should i assign 2 different listeners to 2 walls?