VirtualFramework/Assets/Scripts/Tools/SkinedMeshCollider.cs

18 lines
447 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;
void Update()
{
Mesh colliderMesh = new Mesh();
meshRenderer.BakeMesh(colliderMesh); //<2F><><EFBFBD><EFBFBD>mesh
collider.sharedMesh = null;
collider.sharedMesh = colliderMesh; //<2F><><EFBFBD>µ<EFBFBD>mesh<73><68><EFBFBD><EFBFBD>meshcollider
}
}