Size of the meshes.

Blitz3D Forums/Blitz3D Programming/Size of the meshes.

Yue(Posted 2016) [#1]
What is the recommended size? I have read a documentation in Unity where a cube has a measurement of 1 meter in all its sides and that it has to have as reference this for the models that are imported of modeling tools. In blitz3D which is the measure of a cube, and what size for example in relation to this cube must have a vehicle, a person, a tree?


Zethrax(Posted 2016) [#2]
Blitz3D primitives such as cubes, spheres, etc have a width of 2 world units and are centered at the world center (coordinate 0, 0, 0). Which is pretty silly in my opinion. It would be far better if they had a width of one world unit.

Models created in a model editor will have whatever size you create them at. Importing them into Blitz3D can be pretty tricky in terms of what size they end up as. You would think that 1.0 in a model editor would be 1.0 in Blitz3D, but the reality frequently ends up being different.

Try experimenting with the FitMesh command with the 'uniform' flag set to True to scale the model to fit within a box while maintaining the aspect ratio of the model.

You can also do this using math along with the scalemesh command.

eg (untested).
; Change the height of a loaded model to be 10 world units high while scaling the width and depth in proportion to that.
desired_height# = 10.0 ; This is the height you want to adjust the model to.
model = LoadMesh( "my-model.b3d" )
size# = MeshHeight( model )
scale# = ( 1.0 / size# ) * desired_height#
ScaleMesh model, scale#, scale#, scale#
; At this point your model should be 10 units high without any distortion of its width or depth.



TomToad(Posted 2016) [#3]
A single unit can have any measure you want. It depends most on what type of game you are making. If you are creating a game where you are a bug crawling around, you might have 1 unit = 1 centimeter. If you are making a space game, you might make 1 unit = 1 light year.

There is nothing in B3D to tell it what 1 unit is, so you need to be careful when loading meshes using different units as B3D will assume they are all the same. So if you are loading a picnic table mesh into your bug game, but the table is in meters, then you need to scale by 100 or the table will appear too small.


RemiD(Posted 2016) [#4]

There is nothing in B3D to tell it what 1 unit is


you can get an idea of what 1width1height1depth unit looks like by creating a cube and scaling it like this
Cube1width1height1depth = createcube()
Scalemesh(Cube1width1height1depth,1.0/2,1.0/2,1.0/2)

I personally use 1 unit corresponds to 1 meter.
And, just for information, Fragmotion has the same unit "scale" than Blitz3d.


jfk EO-11110(Posted 2016) [#5]
the scale base you choose should be high enough to prevent precision inaccuracy. Data is 32bit signed floats. An entire world in the range between 0.1 and 0.2 may cause problems. Too high scale neighter works when numbers are higher than I think 160 millions, which you may reach in things like space sims.

1 Blitzunit = 1 meter works well for most applications.