I see two possibilities:
1.
I'd first loop over all Object3D's in the world.
Then see which of these Object3D's are in the camera's FOV.
(Easiest way would be to do a dot product with the camera direction and the vector connecting the camera to each Object3D; then let's say > 0 falls in the camera view and < 0 is behind the camera's view.)
Then next, using the Object3D's in the camera's view, you'll be using polygon manager.
https://www.jpct.net/jpct-ae/doc/com/threed/jpct/PolygonManager.html You'll have something like this:
final Object3D obj = ...;
PolygonManager objPM = obj.getPolygonManager();
for(int id = 0; id < objPM.getMaxPolygonID(); id++){
if(objPM.getTransformedNormal(id).y > 0){
// ^Check if normal of polygon points up...
// Change if this doesn't work
SimpleVector v1 = objPM.getTransformedVertex(id, 0);
SimpleVector v2 = objPM.getTransformedVertex(id, 1);
SimpleVector v3 = objPM.getTransformedVertex(id, 2);
float maxHeight = Math.max(Math.max(v1.y, v2.y), v3.y);
// Do whatever with the max height of this polygon face
}
}
I sort of assumed here that the camera is looking down in the y-axis...
2. Shoot rays for every pixel on the screen and see with which Object3D and polygon face it interacts with. Then use the PolygonManager again to get the distance to that polygon (by averaging vertices or something)...
Make sure the algorithm is RAY:
https://www.jpct.net/jpct-ae/doc/com/threed/jpct/CollisionEvent.htmlMaybe the code in reply #19 can help you with ray-polygon intersection:
https://www.jpct.net/forum2/index.php/topic,4821.msg32989.html#msg32989It's up to you whether you want the ray to be from the camera's origin or parallel to the camera's direction...
To get the 3D position of the screen plane, I think you should use "reproject2D3DWS" in Interact2D. Then you can shoot a ray with vector "normalize((3D position of screen plane) - (camera position))"...
For ray-polygon picking, I think this might be useful:
https://www.jpct.net/wiki/index.php/Picking and
https://www.jpct.net/doc/com/threed/jpct/World.html#calcMinDistance(com.threed.jpct.SimpleVector,%20com.threed.jpct.SimpleVector,%20float)
Sorry for this messy explanation; typing on phone isn't ideal...