Question by
Ticbow · Jul 14, 2020 at 10:49 AM ·
cameracarcamera rotatethird-personcar game
Rotate Camera with player vehicle
I'm trying to have my camera rotate around the player car in a racing game I'm making, But I just don't know how and can't find any tutorials on it. I've made it follow the car across the X, Y, and Z axis, but not rotate. I don't want it to use the mouse or anything, I want it to rotate on it's own.
Here is my code:
using UnityEngine;
using System.Collections;
public class CameraFollow : MonoBehaviour {
public Transform target;
public float smoothSpeed = 0.125f;
public Vector3 offset;
public Vector3 rotOffset;
void LateUpdate()
{
Vector3 desiredPos = target.position + offset;
Vector3 smoothPos = Vector3.Lerp(transform.position, desiredPos, smoothSpeed);
transform.position = smoothPos;
}
}
Comment
Your answer
Follow this Question
Related Questions
(Solveed) How to make object face same direction as its parent? 0 Answers
Camera rotation problem 0 Answers
how do I make a camera follow a player's movement and yaw but no other rotations 0 Answers
unity 5 car tutorial 3D 1 Answer
I can't import a sky-car,I cannot import the basic sky-car. 0 Answers