Jump to content

  • Log In with Google      Sign In   
  • Create Account

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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 anders211   Members   -  Reputation: 195

Like
0Likes
Like

Posted 19 January 2014 - 01:35 PM

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?


Edited by anders211, 19 January 2014 - 01:36 PM.


Sponsor:

#2 SimonForsman   Crossbones+   -  Reputation: 6108

Like
1Likes
Like

Posted 19 January 2014 - 01:43 PM

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)


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!

#3 Brother Bob   Moderators   -  Reputation: 8194

Like
1Likes
Like

Posted 19 January 2014 - 01:44 PM

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.



#4 anders211   Members   -  Reputation: 195

Like
0Likes
Like

Posted 19 January 2014 - 02:15 PM

OK, thanks for help



#5 Vilem Otte   Crossbones+   -  Reputation: 1422

Like
0Likes
Like

Posted 19 January 2014 - 02:41 PM

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).


Edited by Vilem Otte, 19 January 2014 - 02:41 PM.

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





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS