- Home /
Question by
TheBandman · Dec 31, 2014 at 07:10 PM ·
2dcamera-movement
Could somebody please explain me why my camera isn't following my target?
using UnityEngine; using System.Collections;
public class CameraFollow : MonoBehaviour {
public GameObject target;
private Transform targetPos;
// Use this for initialization
void Start () {
targetPos = target.transform;
}
// Update is called once per frame
void Update () {
transform.position = new Vector3(targetPos.position.x, targetPos.position.y, transform.position.z);
}
}
Comment
Your answer
Follow this Question
Related Questions
2D Camera Smooth follow, FixedUpdate and LateUpdate odd difference, help needed. 1 Answer
Help with a 2d camera Controller 1 Answer
How to Manually Move the Camera Horizontally or Vertically? (2D, Parallax), 0 Answers
2d camera panning 1 Answer
Why is Input.mousePosition returning wired values using Cinemachine 2D with dynamic following? 0 Answers