How to Get Camera to Follow Player in Unity?

Camera
By Maya Collins June 1, 2026
Disclosure: As an Amazon Associate, I earn from qualifying purchases. This post may contain affiliate links, which means I may receive a small commission at no extra cost to you.

Honestly, the first time I tried to get a camera to follow my player in Unity, I was convinced it was rocket science. I spent hours wading through forum posts, each one more confusing than the last, filled with jargon that made my brain hurt. It felt like trying to assemble IKEA furniture with instructions written in ancient Greek.

Then I stumbled upon a forum thread where someone casually mentioned a simple script, and it was like a lightbulb flicked on. My entire approach to how to get camera to follow player in unity was wrong; I was overthinking it.

I’d tried some of those fancy third-party assets too, costing me a good $80, only to find they were overkill for what I needed and added bloat I didn’t understand. That was a lesson learned the hard way.

Ditching the Overcomplicated Nonsense

Forget those endless tutorials that talk about quaternions and complex vector math for a basic follow camera. Most of the time, you just need something straightforward that works, not a degree in astrophysics. The sheer volume of advice out there, especially on YouTube, can be overwhelming. It’s like walking into a hardware store looking for a single screw and ending up with a catalog of every bolt ever invented.

My biggest mistake early on was assuming that the most complicated solution was the “best” solution. I remember spending two full weekends trying to implement a smooth follow using a bunch of lerping and damping values I barely understood, all because some tutorial said it was the ‘professional’ way. It ended up being jittery and frankly, looked terrible. After my fourth attempt, I threw it all out and went back to basics.

The Simple Script That Actually Works

So, how do you actually get a camera to follow a player in Unity without pulling your hair out? It’s surprisingly simple. We’re talking about a basic script that updates the camera’s position based on the player’s position, with a little bit of smoothing thrown in so it doesn’t feel like it’s glued to the player’s back.

The core idea is to have your camera’s transform follow your player’s transform. You can do this by directly setting the camera’s position to the player’s position in `LateUpdate()`. Why `LateUpdate()`? Because it runs after all other `Update()` functions have run, meaning your player has already moved for that frame. This prevents that slightly delayed, laggy feel you get if you do it in `Update()`.

Here’s the meat of it. You’ll need a reference to your player’s transform and then, in LateUpdate, you set the camera’s position. You can start with a direct position set, but that feels jarring. For a smoother experience, and this is where most tutorials start to complicate things, you’ll want to use `Vector3.Lerp` or `Vector3.SmoothDamp`. `SmoothDamp` is generally preferred for cameras as it handles velocity and acceleration, giving a much more natural feel. It’s like the difference between slamming on the brakes and gently applying them. (See Also: How To Reset Zosi Camera System )

Understanding Smoothdamp

`Vector3.SmoothDamp` takes your current position, your target position, a reference to a velocity variable (which Unity manages for you), and a `smoothTime`. This `smoothTime` value is key; it dictates how long it takes for the camera to reach the target position. A smaller value means faster, snappier movement; a larger value means it will glide more gently. I usually start with something between 0.1 and 0.5 and tweak it from there. It’s less about perfect numbers and more about how it *feels* when you’re actually playing. The sound of the footsteps on the gravel path changes depending on the camera’s movement, and you want that connection.

Example Script Snippet

“`csharp
using UnityEngine;

public class SimpleFollowCamera : MonoBehaviour
{
public Transform target;
public float smoothTime = 0.3f;

private Vector3 velocity = Vector3.zero;

void LateUpdate()
{
if (target == null)
return;

Vector3 targetPosition = target.position;
transform.position = Vector3.SmoothDamp(transform.position, targetPosition, ref velocity, smoothTime);
}
}
“`

Offsetting the Camera: Beyond Direct Following

Now, most games don’t want the camera glued directly to the player’s eyeballs. You usually want a bit of an offset – maybe to see more of what’s in front of the player, or to give a cinematic feel. This is where adding an offset vector comes in. Instead of setting the camera’s position directly to the player’s, you set it to `target.position + offset`. (See Also: How To Set Up Trace Camera )

This offset can be a fixed value, like `new Vector3(0, 2, -5)` to place the camera behind and slightly above the player. Or, and this is where it gets interesting, you can make the offset dynamic. For instance, you could have the offset adjust slightly based on the player’s movement direction or speed. This is where things start to feel truly professional, not just like a basic follow.

The trick with offsets is to balance them. Too much offset, and your player feels disconnected. Too little, and you’re back to that glued-on feeling. It’s like tuning a guitar; you need that sweet spot where everything sounds right. I spent a good chunk of my early development time just fiddling with Z-axis offsets, trying to find that perfect depth. It’s a surprisingly subtle thing, but it impacts the whole game feel.

What About Rotation?

Directly following the player’s position is only half the battle. If your player rotates, you probably want the camera to rotate with them. Again, the simplest way is to directly set the camera’s rotation to match the player’s. However, this can lead to some nauseating spins, especially in first-person or over-the-shoulder views. You’ll often see advice to use `Quaternion.Lerp` or `Quaternion.Slerp` for smoother rotations. `Slerp` (Spherical Linear Interpolation) is generally better for rotations as it maintains constant angular velocity.

You can also combine position following with rotation. For a third-person perspective, you might want the camera to smoothly follow the player’s position but also smoothly track the player’s *look direction*. This often involves a separate `SmoothDamp` or `Lerp` for the camera’s rotation, targeting the player’s forward vector. It’s a delicate dance between keeping the player in frame and giving the player a good view of their surroundings. Some developers even implement camera control where the player can manually adjust the camera’s angle, adding another layer of complexity but also player agency. For a basic setup, though, just matching the player’s rotation is often enough.

A Common Pitfall: Laggy Rotation

A common mistake I see beginners make is trying to smooth rotation using the same `smoothTime` as position. Rotations are different; they have their own speed and feel. If you use too high a `smoothTime` for rotation, the camera can feel sluggish, like it’s struggling to keep up. Conversely, too low a value can make it snap around unnaturally. I remember one project where the camera rotation was so delayed, it felt like I was playing a game on dial-up internet. It made even simple turns feel awkward.

Advanced Techniques (when You’re Ready)

Once you’ve got the basics down, there are more advanced ways to handle camera following. These can include things like implementing camera boundaries to prevent the camera from going outside certain areas of your level, or using Cinemachine, Unity’s own powerful camera system. Cinemachine abstracts a lot of the complexity away, allowing you to set up sophisticated camera behaviors with visual tools rather than just code. It’s like going from building a birdhouse with hand tools to using a laser cutter – the end result is similar, but the process is vastly different and often more efficient for complex needs.

You can also explore techniques where the camera’s behavior changes based on game state. For example, in a combat sequence, the camera might zoom in or adopt a more aggressive angle. During exploration, it might pull back for a wider view. This level of dynamic camera control is what really separates a basic game from a polished one. The principles are still rooted in position and rotation, but the logic behind *when* and *how* those values change becomes much more intricate. For example, if you’re tracking a fast-moving enemy, the camera might need to anticipate its movement, not just react to its current position. (See Also: How To Factory Reset Hikvision Camera )

Comparing Approaches: Code vs. Cinemachine

ApproachProsConsVerdict
Manual Scripting (SmoothDamp/Lerp)Full control, lightweight, great for learning fundamentals.Can be tedious for complex setups, requires coding knowledge.Excellent for simple follow cameras and learning.
CinemachinePowerful, visual setup, handles many complex scenarios out-of-the-box (framing, noise, etc.).Can be overkill for simple needs, might have a slight learning curve for advanced features.The go-to for most projects needing flexible and advanced camera work.

People Also Ask

How Do I Make a Camera Follow a Player Without Moving?

If you want the camera to follow the player’s *rotation* but not their *position*, you’d typically attach the camera as a child of the player object in the Unity hierarchy. This way, any rotation applied to the parent (the player) will automatically affect the child (the camera). You’d then adjust the camera’s local position to get the desired viewpoint. However, this usually results in a fixed, unmoving camera relative to the player, which is rarely what you want for gameplay.

What Is the Best Way to Follow a Camera in Unity?

For most projects, the most effective and flexible way is to use Unity’s Cinemachine package. It provides a powerful, component-based system for creating dynamic cameras. If you prefer manual coding, using `Vector3.SmoothDamp` for position and potentially `Quaternion.Slerp` for rotation in `LateUpdate()` is a robust method. The ‘best’ way really depends on the complexity of your game and your comfort level with coding versus visual tools.

Can I Use a Script to Make the Camera Follow the Player?

Absolutely. That’s precisely what the `SimpleFollowCamera` script example demonstrated. You can write a script that accesses the player’s transform and updates the camera’s position and rotation accordingly, typically within the `LateUpdate()` function to ensure smooth following after the player has moved.

Final Thoughts

So there you have it. Getting a camera to follow your player in Unity doesn’t need to be some dark art. It’s mostly about understanding how to update the camera’s transform based on the player’s, and then adding just enough smoothing to make it feel right, not jarring.

Honestly, the biggest hurdle is often just getting past the noise and finding that simple, functional script. My own journey involved about $150 in wasted assets and countless hours chasing perfection when a few lines of code would have done the job just fine. It’s a common pitfall for beginners trying to figure out how to get camera to follow player in unity.

Start with the basics, get the `SmoothDamp` working for position, and then think about offsets. Don’t be afraid to experiment with those `smoothTime` values until it feels good in your hands. If it feels off to you, it’s probably off.