- Home /
Scaling the Mesh Collider
Hello all,
I have one plane with a png(with transparency) texture on it. Exe: rock. I want to make a mesh collider that fits exactly with the png(rock). Not the plane.
I made the rock collider mesh in 3D Max, export it to FBX, imported to Unity. There in the Project/prefabs i have the mesh(with the import settings) and Box001 witch is the actual collider.
When i select my plane and put a mesh collider, i can select Box001 from the menu, but is too large...i need to scale it(because my plane is also scaled).
Any ideas pls? Pls ask if i didn't make my self clear.
If your game is 2D then you should consider 2D toolkit which does this for you.
By 2D toolkit do you mean: http://www.unikronsoftware.com/2dtoolkit/? And without 2D Toolkit? Any ideas?
I would suggest use a sphere collider, while not accurate it is much easier to control.
Of course you probably want to use your mesh Box001. So my first suggestion would be to check the import settings of your models, import them at the correct size, then all will be smooth !
Check the Inspector window under Scale Factor (Import settings) : http://docs.unity3d.com/Documentation/Components/class-$$anonymous$$esh.html
Answer by treasgu · Oct 07, 2014 at 03:38 PM
Try to attach the mesh collider to a empty, and scale the empty.
Answer by Mr Mcbyte · Dec 03, 2013 at 08:19 AM
This might be really too late but you can try this:
// Given you are building your quad programmatically
public MeshFilter meshFilter; // Drag the MeshFilter from the game object's inspector.
public MeshCollider meshCollider; // Drag the game object to get the MeshCollider in the inspector.
void Start()
{
meshFileter.mesh.vertices = yourCustomVertices;
gameObject.AddComponent<MeshCollider>();
gameObject.GetComponent<MeshCollider>().sharedMesh = meshFilter.mesh;
meshCollider = gameObject.GetComponent<MeshCollider>();
}
Answer by Tordur · Oct 10, 2012 at 11:53 AM
Replace the mesh collider with a box collider then resize the collider to fit the rock. You can also re position the collider to make it fit, if your rock isn't dead center. Hope that helps :)
Hello, Yes..off course with a box collider it works. But i need a mesh collider.
I have the plane, and i import the special made collider and i can't fit the mesh collider on my image plane...that's the problem.