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.

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>();
}

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 :slight_smile:

need help too

Try to attach the mesh collider to a empty, and scale the empty.

Hi I found the solution

  1. In the Mesh Collider Uncheck the Convex Property and then change the scaling.

  2. Again Check-On the Convex Property in the Mesh Collider and the Scaling applied on Mesh Collider will be shown.

I’m doing this in Unity 2019.4.21f1 ( ALLAH is GREAT).