【发布时间】:2016-08-21 01:05:49
【问题描述】:
我在如何将对象/模型(Quad)的顶点乘以跨轴(Z 或 X)时遇到了一些麻烦,就像在 Pic1 中一样,我从对象/模型(Quad)收集顶点然后复制沿轴的顶点(但三角形也可以接受),我在执行此操作时遇到了麻烦,结果在 Pic2 中。
有人知道怎么做吗?
-Pic1.(我想要实现的目标)
-Pic2.(我得到的结果)
这里是代码,所以你知道我做了什么。
using UnityEngine;
using System.Collections;
public class Extruder : MonoBehaviour {
public Mesh prefab;
public int length;
private Mesh mesh;
private Vector3[] vertices;
private Vector3[] mv;
// Use this for initialization
void Start()
{
vertices = prefab.vertices;
Generate();
}
// Update is called once per frame
void Generate () {
vertices = new Vector3[(length)];
for (int i = 0, x = 0; x <= length; i++, x++)
{
vertices[i] = new Vector3(0, 0, x);
}
mesh.vertices = vertices;
}
private void OnDrawGizmos()
{
Gizmos.color = Color.black;
for (int i = 0; i < vertices.Length; i++)
{
Gizmos.DrawSphere(vertices[i], 0.1f);
}
}
}
【问题讨论】:
标签: c# unity3d vertices multiplication