- Home /
Question on scale of imported 3D models
Hi all, This has to be a an utter noob issue. But I cant find answers on it, so apologies in advance.
I created three cubes in blender. I set the size of each in the inspector. Nothing fancy, one cube was 2,2,2 another 2,1.5,2 etc. So I import to unity and the scale factor is 1. Fine The scale of the cubes in unity(in the inspector) matches the scale that was set in Blender. I made a script that will place (this is simplified) two cubes in a row. Works fine with standard unity cubes. Not so with the blender cubes. There is overlap. Long story short, it appears in order to place the cubes edge to edge I must use a distance of the unity object size added to the mesh size(on a given axis). So two issues. If i print out the size of the mesh on that axis, its not exactly right. for example the size of the x axis for the cube in Blender was set to exactly two. But printing out the size in unity and the size is 2.000000001 which could lead to issues.....Ill need the cubes precisely edge to edge. How do I fix this?
What way is this normally handled in unity? Is it just a case of using the inspector values for the model and doubling those rather than getting the mesh values? (which appear to match, apart from the tiny fractional difference)
Answer by mikelortega · May 27, 2015 at 03:16 PM
Unity works with float precision. It means 2 may be represented as 2.000000001 Take into account floats give you from 6 to 9 significant decimal digits precision. With this in mind, think about alternatives to place your cubes.
If you have a big overlap it cannot be precision, it must be something else.
But just to confirm, if a cube measures 2x2x2 in blender,if I import that into unity at scale factor 1, then the gameobject of the cube sets itself to scale 2,2,2 also. So to space the cubes pretty evenly I need jsut double the unity gameobject(inspector) measurements?
Have you reseted the cube's transform in Blender? $$anonymous$$ake sure it really measures 2,2,2. Or is it 1,1,1 with x2 scale transform?
in Blender it measures, 2,2,2. and scale factor in unity is 1. so then I drag a cube into the scene and in the inspector it measures 2,2,2. But the effective distance between two cubes edge to edge is 4
Can you share a screenshot or your scene? I cannot figure out what's going on there.
Your answer
Follow this Question
Related Questions
Rigging a non-humanoid 3D model from Blender 0 Answers
Vector3 constructor precision 1 Answer
Max scale in unity3d 2 Answers
Blender to Unity question. 2 Answers