Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

procedural mesh collider issue

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

  1. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    210
    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:
    210
    hey,
    problem solved, i was doing something stupid as usual, i set collision convex to true, it should. be set to false instead
     
unityunity