Search Unity

procedural mesh collider issue

Discussion in 'Physics' started by elseforty, Oct 8, 2019.

  1. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    156
    Hi,

    i'm having some issues updating my snake collision body, it returns a simple box shape collision, which is nothing like the snake body mesh i provided in the script, thus collision becomes somehow useless

    any idea on how i can solve this

    the script i'm using to assign new mesh to the collision mesh
    Code (CSharp):
    1.         var meshHolder = DeformedMesh.DMBranches[0].MeshHolder;
    2.        var mesh= meshHolder.GetComponent<MeshFilter>().mesh;
    3.  
    4.         meshHolder.GetComponent<MeshCollider>().sharedMesh = null;
    5.         meshHolder.GetComponent<MeshCollider>().sharedMesh = mesh;
     
  2. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    156
    hey,
    problem solved, i was doing something stupid as usual, i set collision convex to true, it should. be set to false instead