using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GetVertX : MonoBehaviour
{
public GameObject someObject;
public Vector3 thePosition;
//private LookAt la;
void Start()
{
//Mesh mesh = GetComponent<MeshFilter>().sharedMesh;
//Mesh mesh2 = Instantiate(mesh);
//GetComponent<MeshFilter>().sharedMesh = mesh2;
MeshGenerator();
}
private void MeshGenerator()
{
Mesh mesh = GetComponent<MeshFilter>().mesh;
Vector3[] vertices = mesh.vertices;
int v = 0;
Debug.Log(vertices.Length);
//빈도
//for (int i = 0; i < vertices.Length;i++)
//{
// if (i % 5 == 0)
// {
// thePosition = transform.TransformPoint(vertices[i]);
// //lookat
// //Quaternion rot = Quaternion.LookRotation(Vector3.zero - thePosition);
// GameObject quad = Instantiate(someObject, thePosition, someObject.transform.rotation);
// }
//}
while (v < vertices.Length)
{
thePosition = transform.TransformPoint(vertices[v]);
//lookat
//Quaternion rot = Quaternion.LookRotation(Vector3.zero - thePosition);
GameObject quad = Instantiate(someObject, thePosition, someObject.transform.rotation);
//quad.AddComponent<LookAt>();
v++;
}
}
}