Programming Blog

This blog is about technical and programming questions and there solutions. I also cover programs that were asked in various interviews, it will help you to crack the coding round of various interviews

Monday, 31 July 2017

C sharp code to move camera with player in unity 3D

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class cameraController : MonoBehaviour {
public GameObject player;
private Vector3 offset;
void Start () {
offset = transform.position - player.transform.position;
}
void LateUpdate () {
transform.position = player.transform.position + offset;
}
}

No comments:

Post a Comment