Imported mesh bounds size is alwasy too big and pivot point is not aligned


I’m having a bit of difficulty with importing custom meshes to Unity. I"m trying to create a custom mesh with vertices being drawn in screen coordinates. I’ve created an OBJ file with the stored mesh vertices and imported that into Unity and attached it to a game object. The mesh appears correctly however the mesh/render bounds are far too big and my pivot point is off in space somewhere and not connected to the mesh.

After some reading Ive become aware that Unity has a limitation with being able to change the pivot point of a mesh. I’ve tried offsets but because I have different meshes/sizes this wont work every time.

I’m wondering if someone knows why Unity draws the mesh a certain size (visually) but the entire game object size is so much bigger? This is making it difficult for me to draw the mesh at the appropriate space. Does anyone have any ideas?

I’ve been able to offset the pivot point using the mesh bounds however, now the problem seems that the bounds are actually bigger than the mesh itself. I’ve drawn a debug line from the bounds min/max points and it appears that the line is in 3d space going through the center of the mesh (extending into Z).

Is there anyway to create a 2D mesh in unity? simply a plane that always faces towards the camera and whose bounds reflect the mesh vertices instead of some world points? I’m working in 2D and so far have found Unity quite difficult to work with on account of trying to convert everything from 3D to a 2D application of it.


Firstly I’m not sure if you should be doing anything at all with meshes in relation to what you’re trying to achieve, see below. But re your specific question, two possibilities come to mind (A) a stray vert (B) recalculating the bounds.

“The mesh appears correctly however the mesh/render bounds are far too big”

are you ABSOLUTELY SURE you do not have any stray verts? one will do it, an easy mistake to make! use this simple technique:

to run through your vertices array and draw a big red ball at every single one. you’ll soon see if there’s an error.

(PS if you are new to working w/ mesh in unity is always worth remembering that the .vertices call CREATES A COPY of the verts, in distinction from all other properties in Unity.

function showAllMyBallsClearly()
    var copyOfVerts : Vector3[] = GetComponent(MeshFilter).mesh;

    for (var i = 0; i < copyOfVerts.Length; i++)
      .. draw a ball there


did you know about this function,

maybe that’s the secret here.

#regarding 2D …

you ask a separate question about 2D. Realistically for 2D in Unity you need to grab “2DToolkit” (asset store)

there;s no other realistic way to do 2D in Unity – the time saving is staggering. you just drop all your sprites in the 2DTK system, and it completely handles everything for you, from packing atlases to completely handling “flat meshes” as you say, to animations, to doing everything in one draw call.