VirtualFramework/Assets/Scripts/Tools/SkinedMeshCollider.cs

23 lines
518 B
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SkinedMeshCollider : MonoBehaviour
{
public SkinnedMeshRenderer meshRenderer;
public MeshCollider collider;
2024-12-26 21:33:08 +08:00
public Mesh colliderMesh;
private void Awake()
{
colliderMesh = new Mesh();
}
void Update()
{
2024-12-26 21:33:08 +08:00
meshRenderer.BakeMesh(colliderMesh); //<2F><><EFBFBD><EFBFBD>mesh
collider.sharedMesh = null;
collider.sharedMesh = colliderMesh; //<2F><><EFBFBD>µ<EFBFBD>mesh<73><68><EFBFBD><EFBFBD>meshcollider
}
}