Hi,
My question is how can a I get the PolygonID of an event which type is TYPE_SOURCE . The object's(this object is the only one moving in my scene) collision mode which triggers this event is set to COLLISION_CHECK_SELF. The other objects (which can't move) are set to COLLISION_CHECK_OTHERS. That is for me a problem because i need the polygonID of the moving object.
here is the collision setup in code :
Ball.setCollisionMode(Object3D.COLLISION_CHECK_SELF);
Wall.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
Cube.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
ballPolygonManager = Ball.getPolygonManager();
wallPolygonManager = Wall.getPolygonManager();
cubePolygonManager = Cube.getPolygonManager();
Wall.addCollisionListener(new CollisionListener() {
public void collision(CollisionEvent ce) {
polygonID = ce.getPolygonIDs();
polygonManager = wallPolygonManager;
}
public boolean requiresPolygonIDs() {
return true;
}
});
Cube.addCollisionListener(new CollisionListener() {
public void collision(CollisionEvent ce) {
polygonID = ce.getPolygonIDs();
polygonManager = cubePolygonManager;
}
public boolean requiresPolygonIDs() {
return true;
}
});
Thanks for any help
There's no such thing. Collisions in jPCT are always ray/sphere/ellipsoid against polygons. It's not polygon against polygon and that's why there is no such thing as a source polygon.
You could probably get the transformed center of a given triangle on the moving object then call something like calcMinDistance() on the static objects. Come to think of it, what you probably want is the opposite: call calcMinDistance() from the static objects and get the polygon ID from the CollisionEvent (your listener implementation must return that you want the ID).