FollowCamera + rotation
Hello i need help gettin my main camera to rotatewhile following my Main player Prefab. im making a network game and im using a follow script on the Maincamera to get it to follow the player prefab, i cant add a maincamera to the player prefab and get the normal follow distance and rotation because then player 2 on the network will get the same camera...
Im using this Followcamera Script: using UnityEngine; using System.Collections;
public class CameraFollow : MonoBehaviour {
public Transform target; //what to follow
public float smoothing = 5f; //camera speed
Vector3 offset;
void Start()
{
offset = transform.position - target.position;
}
void FixedUpdate()
{
Vector3 targetCamPos = target.position + offset;
transform.position = Vector3.Lerp (transform.position, targetCamPos,smoothing * Time.deltaTime);
}
}
And i have this line of code in my player controller script
Camera.main.GetComponent<CameraFollow>().target=transform; //Fix camera on "me"
Your answer
Follow this Question
Related Questions
Problem with pan and rotate camera with mouse 0 Answers
How do i tell the camera to only follow the gameObject x orientation 0 Answers
Cinemachine - Weird rotations when blending between two cameras? 0 Answers
How to make the GUI Buttons consistent in screen while the background screen is rotatable? 0 Answers
How to detect how much was mouse moved only horizontaly? 1 Answer