Creating smooth and realistic third-person movement in Unity is a fundamental skill for game developers. Mastering this can significantly enhance the user experience of your games. This guide will walk you through the steps to achieve third-person movement in Unity with C# scripting.

Before we dive in, ensure you have a basic understanding of Unity and C#. Additionally, have a character model and a scene ready for testing. Let's get started!
![Unity 5 Third Person Controller [Tutorial][C#] - Unity 3d](https://i.pinimg.com/originals/e2/40/42/e2404276599c1d05a8df315d26a4d54e.jpg)
Setting Up Your Scene
First, import your character model into Unity. Position and scale it in your scene hierarchically. Ensure it's assigned a Rigidbody component for physics-based movements.

Next, create an empty GameObject to serve as the control point for your camera. Name it 'Camera Follower'. This will help you create a smooth third-person camera follow.
Creating the Player Movement Script

Create a new C# script named 'PlayerMovement'. Attach it to your character model. This script will handle your player's movement.
Start by defining your movement variables at the top of your script:
public float speed = 5.0f;
public float gravity = -9.81f;
public float jumpForce = 7.0f;
private float moveX;
private float moveY;
private bool isGrounded;
Implementing the Player Movement

The Update() function will handle user inputs and the FixedUpdate() function will apply the physics-based movement. Here's how to implement it:
void Update()
{
moveX = Input.GetAxis("Horizontal") * speed;
moveY = Input.GetAxis("Vertical") * speed;
if (Input.GetButtonDown("Jump") && isGrounded)
{
GetComponent().velocity = new Vector3(GetComponent().velocity.x, jumpForce, GetComponent().velocity.z);
isGrounded = false;
}
}
void FixedUpdate()
{
Move(moveX, moveY);
}
Now, create the 'Move' method to apply the final movement calculations:
void Move(float moveX, float moveY)
{
Vector3 movement = new Vector3(moveX, 0, moveY);
Vector3 targetVelocity = transform.TransformDirection(movement) * speed;
Vector3 gravity = new Vector3(0.0f, this.gravity * Time.deltaTime, 0.0f);
targetVelocity.y = gravity.y;
GetComponent().velocity = targetVelocity;
}
Creating the Third-Person Camera

Third-person cameras typically follow the player from a set distance and angle. Let's create this now.
In the Unity editor, right-click and add a 'Camera' to your 'Camera Follower' object. Position and rotate it to your desired view. You can fine-tune this later.











![Create a Match-3 Game in Unity! [PART 3]](https://i.pinimg.com/originals/64/c5/02/64c50268b2c29013afcbd9a351897e4f.jpg)








Scripting the Third-Person Camera
Create a new C# script named 'ThirdPersonCamera'. Attach this script to your 'Camera Follower' object. This script will make your camera 'follow' the player.
Implement the 'Update' function to follow the player's position and rotation:
void Update()
{
transform.position = player.transform.position + new Vector3(0, 0, -10);
transform.rotation = Quaternion.LookRotation(player.transform.position - transform.position);
}
This script will keep your camera at a -10 unit distance from the player, following behind them. You can adjust these values to change the field of view.
Congratulations, you've successfully created third-person movement and camera follow in Unity! Keep experimenting with different speeds, jump forces, camera distances, and angles to create unique gameplay experiences. Happy coding!