CollisionEvent event;
int[] ids = event.getPolygonIDs();
Object3D[] objs = event.getTargets();
When objs.length > 1, how to judge which PolygonID(ids[j]) belongs to which Object3D(objs[j])? For example, to calc:
SimpleVector normal = objs[i].getPolygonManager().getTransformedNormal(ids[i]);
			
			
			
				The getTargets()-methods was a late addition for some purpose that i don't know anymore. Maybe somebody requested that. It has not direct relation to the getPolygonIds()-method. That method returned the affected polygons for the object that actually received this event if it's of type target. What this means is, that if you assign a listener to some object and that object is the target of a collision, then you'll get the polygon ids for that object in the ids-array. If you want that for multiple targets, you have to assign the listener to multiple objects.
			
			
			
				
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?
			
			
			
				Quote from: kiffa on November 07, 2013, 12:31:34 PM
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?
No, wrong. That's what i tried to say with
QuoteIt has not direct relation to the getPolygonIds()-method.
You have to attach the listener to both walls and you'll get the corresponding ids from both listener calls. The getTargets()-method was a late addition to the listener interface that somebody requested. Even if the event is of type source, you'll get all targets by calling that method but not a single polygon id.
			
 
			
			
				I'm clear, Thanks!