Home / Language / English / User view distance

User view distance

This bit of code allow user to see a long way without far parts of it being clipped and see close things without  seeing through them.

View view = universe.getViewer(  ).getView(  );
view.setBackClipDistance(50);      // can see a long way
view.setFrontClipDistance(0.05);   // can see close things

An additional line sets up depth sorting for transparent objects in the world:


Sorting multiple transparent objects is necessary in Terra3D since ground cover objects are implemented as transparent GIFs textured over shapes. It’s likely that the user’s viewpoint will include many overlapping instances of these. The default behavior of Java 3D is to do no depth sorting, which may cause the transparent objects to be drawn in the wrong order, so trees and bushes in the distance are drawn in front of nearer ones.

About Mohammad Khazab

Leave a Reply

%d bloggers like this: