-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAnimation_code.cs
37 lines (31 loc) · 979 Bytes
/
Animation_code.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using System.Threading;
public class AnimationCode : MonoBehaviour
{
public GameObject[] Body;
List<string> lines;
int counter = 0;
// Start is called before the first frame update
void Start()
{
lines = System.IO.File.ReadLines("Assets/AnimationFile.txt").ToList();
}
// Update is called once per frame
void Update()
{
string[] points = lines[counter].Split(',');
for (int i =0; i<=32;i++)
{
float x = float.Parse(points[0 + (i * 3)]) / 100;
float y = float.Parse(points[1 + (i * 3)]) / 100;
float z = float.Parse(points[2 + (i * 3)]) / 300;
Body[i].transform.localPosition = new Vector3(x, y, z);
}
counter += 1;
if (counter == lines.Count) { counter = 0; }
Thread.Sleep(30);
}
}