No arm camera?

I’ve done that before, positioning the camera without arm it works fine yet :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FollowController : MonoBehaviour {

	public Transform Player;

	private Vector3 playerPos;
	private Vector3 cameraOffset;

	// Use this for initialization
	void Start ()
	{
		playerPos = Player.position;
		cameraOffset = transform.position - playerPos;
	}
	
	// Update is called once per frame
	void LateUpdate () {
		playerPos = Player.position;
		float newPosX = playerPos.x + cameraOffset.x;
		float newPosZ = playerPos.z + cameraOffset.z;

		Vector3 newPos = new Vector3(
			newPosX,
			transform.position.y,
			newPosZ
		);

		transform.position = newPos;
	}
}

Privacy & Terms