TerrainBlock question

Hi All,

As outlined in the javadoc (http://www.jmonkeyengine.com/doc/com/jmex/terrain/TerrainBlock.html), the second parameter to TerrainBlock is size. Now, I was wondering what the metric for this size parameter is. Maybe somebody could enlighten me? :slight_smile: Is it in pixels? If not, what is the relation between this metric and pixels?

Thanks for your time :slight_smile:

There is no metric, its units, so you can define for yourself what 1 unit represents for you. Imagine this: when you move away from the object it gets seemingly smaller, so it uses fewer pixels. So in 3D, you never count anything in pixels, its just units.



Thanks Normen :slight_smile:

Given that these units are not formally defined, is there any way in which I could determine the width of my window in these units? This may sound odd, however the background to this is that I developed some map projections in Java2D. The underlying principle behind these projections is their translation from a lat,long coordinate system into pixels. That is, the width of my container in pixels would initially be used to deduce the translation from a given lat,long into a pixel position. I would like to apply the same principle here…

You can convert camera to world coordinates using the cameras methods for that. This way you can determine where on the screen a certain point in the world is. You could also use shaders, which know their pixel positions etc. on rendering. Converting from camera to world space is a little more tricky as the screen coordinate is just a ray (2 dimensions) into the world. Look at the picking examples for that.



1 Like

I see. Thanks for this!