Hi there. I am trying to create an fps game but there is a problem: everytime I start the game, the camera’s location changes and goes out of the cylinder (that acts as the character’s hitbox for now). I have placed the camera in the cylinder and scripted it so it remains attached, but it goes atleast 200px away from the cylinder but still remains connected to the cylinder. The code for the camera is:
using UnityEngine;
using System.Collections;
public class CameraMovement : MonoBehaviour {
public GameObject player;
private Vector3 offset;
void Start () {
offset = transform.position;
}
void LateUpdate () {
transform.position = player.transform.position + offset;
}
}