Since I am new to Unity I might not explain this well, so please ask questions if something is not clear.
My game object is a human eye, so it is made up of a lot of meshes.
This eye is deformable with a slider. So when i deform it I want the mesh colliders get updated at the end of the deformation.
I tried it like this but the colliders don’t get updated, although the debug shows that I find the mesh names in the SkinnedMeshRenderer and the MeshCollider.
Could you help me find out why I can’t update the collider?
An animated SkinnedMeshRenderer doesn’t update the mesh collider as it moves and there’s no way to get the current state of the mesh deformation to update it yourself. If you can somehow handle the deformation from your own code, you can assign the changed mesh to the collider’s sharedMesh property to update it.
Thanks andeeee!
Before posting this question I asked the designer if she is using the SkinnedMeshRender (SMR) on purpose and she said that when she imports her meshes in Unity from 3DSmax, it is set automatically to SMR by Unity.
I am not a designer so I don’t know if there would be a workaround for this, but do you know if it is something defined by 3DSmax or Unity?
Would it be possible to use another Renderer that could update the collider on animation?
I talked again with the designer to understand more clearly how deforms are done and she said that she uses skinning in 3dsmax so that bones can be deformed in the skeleton. So when importing the fbx files unity attaches SMR to them.
Bones have differently weighted values for deformation and they get the deformation amount from slider values.
I don’t know if I’ve given sufficient information on this matter so that someone experimented can tell if there is workaround for updating the mesh colliders or to use any other technique to be able to interact with the surface and parts of the skeleton quite precisely.
Since you can’t get the current state of the skinned mesh from the graphics card, there’s no way to do this. You can always update meshes manually using the Mesh class, but then you have to handle all the vertex deforming yourself.