Search Unity

Convert UnityEngine.Mesh to Collider in code

Discussion in 'Physics for ECS' started by zardini123, Jun 23, 2020.

  1. zardini123

    zardini123

    Joined:
    Jan 5, 2013
    Posts:
    68
    Is there any functions inside the Unity Physics package that converts a UnityEngine.Mesh into a Unity Physics collider?
     
  2. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    You can use a MeshCollider.Create() that takes vertices and indices which you can get from UnityEngine.Mesh.GetVertices() and UnityEngine.Mesh.GetIndices().