using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class CreateModelByVertices : MonoBehaviour
{
public int _resolution;
private GameObject _Root;
private MeshData[] _meshDatas;
private List<MeshFilter> _meshFilterList = new List<MeshFilter>();
[ContextMenu("生成Cube")]
public void CreateCube()
{
if (_Root != null)
DestroyImmediate(_Root);
_meshFilterList.Clear();
_meshDatas = GenerateFaces(_resolution);
_Root = new GameObject("Go");
foreach (var meshData in _meshDatas)
{
GameObject faceGo = new GameObject("face");
faceGo.transform.SetParent(_Root.transform);
var meshFilter = faceGo.AddComponent<MeshFilter>();
Mesh mesh = <
根据顶点创建Cube Sphere
最新推荐文章于 2023-05-16 17:25:49 发布
这篇博客详细介绍了如何在Unity中通过调整顶点坐标,将一个立方体转换成一个平滑的球体,这一过程对于3D建模和游戏开发中的图形渲染具有实际应用价值。
摘要由CSDN通过智能技术生成