Hi Unity Community
I having issues with some code where I am trying to assign new values from Vector3 array to that of the vertices in the object’s mesh.
For my needs I could just delete the existing object in scene and create a new one but that isn’t really solving the issue of my logic so could anyone please provide me some pointers as to where I am going wrong?
Many thanks in advance,
Ryan
function ExpVertText(userText : String)
{
var textArray = userText.Substring (1, userText.Length-2).Split ([")("], System.StringSplitOptions.RemoveEmptyEntries);
var vectArray = new Vector3[textArray.Length];
for (var i = 0; i < textArray.Length; i++) {
var numbers = textArray*.Split(","[0]);*
_ vectArray = Vector3(parseFloat(numbers[0]), parseFloat(numbers[1]), parseFloat(numbers[2]));_
* }*
* Debug.Log(“Mesh Stored”);*
* var curObj = GameObject.Find(“TestObject”); //current object*
* var curVertArray = curObj.GetComponent(MeshFilter).mesh.vertices;*
* for (var j = 0; j < vectArray.Length; j++) {*
* Debug.Log("Old vert: " + curVertArray[j]);*
* curVertArray[j] = vectArray[j];*
* Debug.Log("New vert: " + curVertArray[j]);*
* }*
* Debug.Log(“Mesh Updated”);*
* return curObj;*
}