Collider on Skinned Mesh

Hello all.

I have Shinned Mesh with 2 bones for nonlinear Scalind (GO change from one side of axis). But Mesh Collider does not change its shape following the change in the mesh.

Maybe are there other methods for nonlinear Scaling if this unsolvable problem?

This is an old post, but I figured I would answer because there is a much simpler way to do this (at least in Unity 5, not sure if this would have worked at the time the question was posed):

    SkinnedMeshRenderer meshRenderer;
    MeshCollider collider;
   
    public void UpdateCollider() {
        Mesh colliderMesh = new Mesh();
        meshRenderer.BakeMesh(colliderMesh);
        collider.sharedMesh = null;
        collider.sharedMesh = colliderMesh;
    }

You would of course initialize the MeshCollider and SkinnedMeshRenderer.

This takes a snapshot of the deformed mesh, applies it to colliderMesh, then uses that for the MeshCollider. you just need to call it when you want to update the collider to match the mesh

You wouldn't want the mesh collider to update with a skinned mesh even if it was possible, since it would be very slow. You can attach primitive colliders to bones instead.

I found a script to do this on the forum from user Darkrobyn. I believe this code reproduces the calculations that Unity is doing internally to deform the mesh.

It's working for me, but I currently have a fairly simple mesh and bone setup. I'm firing the forceUpdate occasionally (on mouse up events) which works great in my application.

Have a look here:

http://forum.unity3d.com/threads/14378-Raycast-without-colliders

The poster didn't include a couple of custom classes that you'll have to add. Something like this:

class CVertexWeight
{

    public int index;
    public Vector3 localPosition;
    public float weight;

    public CVertexWeight(int i, Vector3 p, float w)
    {

        index = i;
        localPosition = p;
        weight = w;
    }

}

class CWeightList
{

    public Transform transform;
    public ArrayList weights;
    public CWeightList()
    {
        weights = new ArrayList(); 
    }

}

You Can Watch This Video :-