VirtualFramework/Assets/Scripts/Tools/SkinedMeshCollider.cs

23 lines
518 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
}
}