What float unit should I choose for 1 [m]?

Started by
3 comments, last by Vilem Otte 10 years, 2 months ago

Hi

What unit should I choose for 1 [m], what value is the best? For example I have a football mesh. In reality the radius of the ball is about 11 cm (0,11m). Here on the screen:

http://imagizer.imageshack.us/v2/800x600q90/855/m2z1.jpg

the radius is 0,70 (I have float variable in which I store 0.70f). So this makes that in my game 0,70 [unit] means 0.11 [m], so 1 [m] is in fact 6,3636 units in my game.

I would like to scale my mesh and choose the scale of the world that 1 [m] = 1 [unit]. Without this there are some issues with physic. So from physic engine and generally logical point of view it would be the best to choose 1[m] as 1[unit], so radius float 0.11f means 0.11 [m]. However You know floats numbers have inacurracies, so is it good to choose 1[m] as 1[unit] or maybe better choice would be 1[m] as 100[unit]??? What is the best scale of the game environment?

Advertisement

for a football game 1 unit = 1m is a good scale. (players would then be up to 2 units high and the field itself is a bit over 100 units long)

[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

The floating point precision is relative, not absolute, so you have the same relative resolution at any scale. Base your decision on what makes sense for you, but sticking to standard units is a good decision.

OK, thanks for help

Just a note - Sticking to standard units is especially good once you get into physics parts, otherwise you might need some multiplications-by-constant to do it correctly (and this can become bloody mess quite soon).

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com

This topic is closed to new replies.

Advertisement