- Home /
My Camera lookAt script doesn't work
Hi, i'm totally new to Unity so please dont blame me for anything :)
I'm trying to make a camera that follows a ball(the player). But somehow it doesnt look at the ball, but follows it, like if it was over the ball.
Here is my script:
using UnityEngine;
using System.Collections;
public class CameraMotor : MonoBehaviour
{
public Transform lookAt;
private Vector3 offset;
private float distance = 5.0f;
private float yOffset = 3.5f;
private void Start()
{
offset = new Vector3 (0, yOffset, -1f * distance);
}
private void Update()
{
transform.position = lookAt.position + offset;
}
}
All help is appreciated:)
Comment