Question by
unity_85BDB250C54EDA963793 · Aug 19, 2021 at 06:08 PM ·
camerapositionplayer
My camera follows my player so that the camera goes inside the player. What can I do?
My problem is that the camera goes into the player so that it only sees the background and not the player.
My script looks like this:
using UnityEngine;
public class Follow : MonoBehaviour { private Transform playerTransform;
public float offset;
void Start()
{
playerTransform = GameObject.FindGameObjectWithTag ("Player") .transform;
}
void LateUpdate() { Vector3 temp = playerTransform.position;
temp.x = playerTransform.position.x;
temp.y = playerTransform.position.y;
temp.x += offset;
temp.y += offset;
transform.position = temp;
}
}
Comment
Your answer
Follow this Question
Related Questions
How to center an object to a camera, but away from it? 1 Answer
Set camera position to end animation camera position? 0 Answers
When character looks up he goes up(camera bug) 0 Answers
How to get the object relative pose with respect to camera (position+rotation) 1 Answer
A object closer to camera than B object, but A object is behind B and is not visible 1 Answer