I'm trying to have a point light positioned directly above a cube follow wherever the cube goes. However, it doesn't move at all. This is my code for the light:
using UnityEngine;
using System.Collections;
public class SpotlightController : MonoBehaviour {
// Use this for initialization
void Start() {
}
void OnGUI(){
GUI.Label(new Rect(20,50,500,20), "(" + transform.position.x.ToString() + ", " + transform.position.y.ToString() + ", " + transform.position.z + ")");
}
// Update is called once per frame
void Update() {
GameObject cube = GameObject.Find("Cube");
float xlocation = cube.transform.position.x;
float zlocation = cube.transform.position.z;
transform.TransformPoint(new Vector3(xlocation,transform.position.y, zlocation) * Time.smoothDeltaTime);
//transform.Translate(new Vector3(xlocation, 0, zlocation));
}
}