OuijaMTLGJ2016/Assets/scripts/SelectorBehaviour.cs
Dmitri Kolytchev 27fbca1c46 initial commit
2016-01-30 01:15:35 -05:00

22 lines
447 B
C#

using UnityEngine;
using System.Collections;
public class SelectorBehaviour : MonoBehaviour {
public GameObject[] follows;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
Vector3 averagePosition = new Vector3 (0, 0, 0);
for (int i = 0, j = follows.Length; i<j; i++) {
averagePosition += follows[i].transform.position / j;
}
transform.position = averagePosition;
}
}