- Home /
Change Angle of Top Down Camera
I have a scene set up with a cube that has some basic 8 directional movement. The camera I have is for top down use, but I would like it to be angled closer to 45 degrees rather than 90 and still center on the character. Currently when I do this the camera literally centers on the character and looks away from him. When I attempt the LookAt function the camera turns with the character which is undesirable. Any Ideas on how to fix my code / any tutorials that will help me understand camera functions better specifically involving vector3's.
Here's the code:
using UnityEngine;
using System.Collections;
public class TopDownCam : MonoBehaviour
{
public float dampening = 1;
public GameObject target;
Vector3 offset;
void Start()
{
offset = transform.position - target.transform.position;
}
void LateUpdate()
{
Vector3 endPos = target.transform.position + offset;
Vector3 position = Vector3.Lerp (transform.position, endPos, Time.deltaTime * dampening);
transform.position = position;
}
}
Your answer
Follow this Question
Related Questions
Head Rotation while Animation is played 2 Answers
make a target camera? 1 Answer
Change the object the camera looks at? 1 Answer
Change 3D Camera to 2D 0 Answers
I need help with a model 0 Answers