Created
April 16, 2020 15:23
-
-
Save gkagm2/ab185883d4497e6742669cf490dcdc86 to your computer and use it in GitHub Desktop.
Vertices들의 worldPosition 좌표 구하기.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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