Skip to content

Instantly share code, notes, and snippets.

@gkagm2
Created April 16, 2020 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gkagm2/ab185883d4497e6742669cf490dcdc86 to your computer and use it in GitHub Desktop.
Save gkagm2/ab185883d4497e6742669cf490dcdc86 to your computer and use it in GitHub Desktop.
Vertices들의 worldPosition 좌표 구하기.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Test_ModelAnimationPath : MonoBehaviour
{
public string positionName;
public MeshFilter meshFilts;
public List<Vector3> vecList;
// Start is called before the first frame update
void Start()
{
positionName = "Black0";
vecList = new List<Vector3>();
int animCount = 1;
GameObject obj;
while (true)
{
obj = transform.Find(positionName + animCount.ToString()).gameObject;
if (obj == null)
{
break;
}
meshFilts = obj.GetComponent<MeshFilter>();
vecList.Add(meshFilts.transform.TransformPoint(meshFilts.mesh.vertices[0]));
Debug.Log(positionName + animCount + " pos : " + vecList[animCount - 1]);
++animCount;
}
Debug.Log("anumCount : " + animCount);
// Same TransformPoint();
//Matrix4x4 localToWorld = posObj[0].transform.localToWorldMatrix;
//Debug.Log("localToWorld : " + localToWorld);
//Vector3 world_v = localToWorld.MultiplyPoint3x4(mesh.vertices[0]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment