using System.Collections; using System.Collections.Generic; using UnityEngine; public class SkinedMeshCollider : MonoBehaviour { public SkinnedMeshRenderer meshRenderer; public MeshCollider collider; public Mesh colliderMesh; private void Awake() { colliderMesh = new Mesh(); } void Update() { meshRenderer.BakeMesh(colliderMesh); //更新mesh collider.sharedMesh = null; collider.sharedMesh = colliderMesh; //将新的mesh赋给meshcollider } }