x


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?

more ▼

asked Dec 23 '10 at 10:22 AM

Robotron18 gravatar image

Robotron18
113 3 5 12

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Dec 23 '10 at 03:07 PM

Eric5h5 gravatar image

Eric5h5
80.3k 42 132 521

Update sharedMesh of Mesh Collider does not alter the shape collider. Changes only the base mesh. Is there a way to change the collider at runtime?

Dec 25 '10 at 06:39 AM Robotron18

Please read my answer again.

Dec 25 '10 at 05:42 PM Eric5h5

If I could use a primitive Collider, certainly would have done it. But thanks.

Dec 27 '10 at 03:10 PM Robotron18

Notice the plural: "attach primitive colliderS". Not just one.

Dec 27 '10 at 07:43 PM Eric5h5

This is the first thing I did before asking a question. I'll try to solve the problem by any design method. Thank you.

Dec 28 '10 at 08:48 AM Robotron18
(comments are locked)
10|3000 characters needed characters left

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

}
more ▼

answered Jan 26 '11 at 09:39 PM

mattirwin gravatar image

mattirwin
131 1 1 5

I read that at first as "CervixWeight". What's a C?!

Jan 26 '11 at 09:53 PM Jessy

A capital C is sometimes used as a prefix for class names to indicate that it's a class. I just followed the naming in the original script. If you download the original script you'll find those classes are missing.

Jan 26 '11 at 10:17 PM mattirwin

works as a charm! and slow as hell as expected. :P

Apr 19 at 04:53 PM Cawas
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1707
x1366
x25

asked: Dec 23 '10 at 10:22 AM

Seen: 2292 times

Last Updated: Apr 19 at 08:25 PM