IMHOTEP Framework
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
CopyPosition.cs
1 using UnityEngine;
2 using System.Collections;
3 
4 public class CopyPosition : MonoBehaviour {
5 
6  public Transform target;
7  public bool copyX = false;
8  public bool copyY = false;
9  public bool copyZ = false;
10  public float offsetX = 0f;
11  public float offsetY = 0f;
12  public float offsetZ = 0f;
13 
14  void Update () {
15  Vector3 pos = transform.position;
16  if (copyX)
17  pos.x = target.position.x + offsetX;
18  if (copyY)
19  pos.y = target.position.y + offsetY;
20  if (copyZ)
21  pos.z = target.position.z + offsetZ;
22  transform.position = pos;
23  }
24 }