- Home /
Help with character movement and camera
Working on this project and I'm trying to figure out how to get my character and camera to work like the video below. Any advice? Couldn't find any tutorials on it. I just want my model and camera to move and follow the player like the video.
Comment
Best Answer
Answer by Cornelis-de-Jager · Jul 03, 2019 at 02:01 AM
I just watched the start - so appologise if there are special effects that I missed. But the camera movement is very simple to do.
Attach the following script to your camera.
public class CameraFollower : MonoBehaviour {
public Transform player;
public float smoothingFactor = 1.5f; // The higher the smoother the follow
Vector3 offset;
void Start () {
offset = transform.position - player.position;
}
void Update () => CameraFollow ();
void CameraFollow () {
transform.position = Vector3.Lerp (transform.position, transform.position + offset, smoothingFactor);
}
}
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
Issue with mecanim playing an animation using setbool 1 Answer
Animation at the end of the level 1 Answer
How to Serialize an AnimationState 0 Answers