In my game, I have a big box (1000000 x 1000000 x 100000).

When I load it to the game, the viewport only showed a small portion of the box.

But I want the box to show wholly.

Do you guys know how to resolve this?

As far as I understood, it is not wise to use this kind of big objects. This also has to do with the precision of integers and floats. Better is to scale your box to a smaller dimension.

Further, setting the frustum of the camera and it’s far clipping plane might help.

@blacksilver : It seems it’s not related to viewport size. Rather it would be the scale of the display…

@husky : there is no precision trouble with integers. But there is with floats. And all is a float in JME.

@blacksilver : Why do you need such a big box ?

there is no precision trouble with integers. But there is with floats. And all is a float in JME.Thanks for the clarification. I knew there was something with the precision, just not what exactly anymore :)

@blacksilver

Scaling your entire application is the wisest thing to do. If this is not possible, try setting the clipping planes (both far and near). Also, you might to reposition your camera so it is further away from the box?

Yep, for even more precision, an integer is a 32 bits number with fixed precision. It goes from −2,147,483,648 to 2,147,483,647.

The float also uses 32 bits, but with varying precision. You still have 4M different numbers, but only 23 significant bits, and 8 bits to describe the decimal point position. Therefore you can have very large numbers (+/- 3.4 E 38) but with a low precision or very small numbers (+/- 1.4 E-47) with the same precision (23 bits or almost 7 decimal digits).

So with floats, 200000 + 1 = 200001, but 20000000+1 = 20000000 (out of precision)

@blacksilver make a smaller box. You define the scale of your world so if you need massive objects just make the scale smaller.

@yang71 actually its worse than that as 200000+1 probably equals something like 200001.00000000012312

http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html