How to prevent camera rotation

In my game I have object (citizen), which move from point to point.
It contain camera, which follow the citizen. When citizen rotate, I don’t want camera to be rotated.

But camera is inside object, which rotates. How can I prevent camera rotation?

1

I use this script to make my camera follow my player object.

using UnityEngine;
using System.Collections;

public class FollowPlayerCSharp : MonoBehaviour
{
	public Transform target; //This will be your citizen
	public float distance;
	

	void Update()
	{
		if (!target)
		{
			// Search for object with Player tag
			var go = GameObject.FindWithTag("Player");
			// Check we found an object with the player tag
			if (go)
			// Set the target to the object we found
			target = go.transform;
		}

		if (target)
			transform.position =new Vector3(target.position.x, target.position.y+25, target.position.z - distance);
	}
}

Hope this is useful to you

:slight_smile: