# How to make a 3D camera rotate relative to the world?

I followed this tutorial from a few years ago about making an isometric view camera, and usually it works perfectly like the video, but somehow today when I followed the tutorial again the camera does not rotate as expected.

I would like to make it so the camera can rotate relative to the world (So its like the camera is rotating around a pivot and also facing towards it).

Everything else, movement, zoom, whatever works perfectly, just the rotation doesn’t, and I’ve checked many times that nothing should be wrong. Hope someone can explain what the problem is and how to fix it! Thanks!

Here is the rotation parts of the camera controller script:

``````    public float movementTime;
public float rotationAmount;

public Quaternion newRotation;

void Start()
{
newRotation = transform.rotation;
}

void LateUpdate()
{
HandleMovementInput();
}

void HandleMovementInput()
{
if (Input.GetKey(KeyCode.Q))
{
newRotation *= Quaternion.Euler(Vector3.up * rotationAmount);
}
if (Input.GetKey(KeyCode.E))
{
newRotation *= Quaternion.Euler(Vector3.up * -rotationAmount);
}

transform.rotation = Quaternion.Lerp(transform.rotation, newRotation, Time.deltaTime * movementTime);
}
}
``````

So, if what you’re trying to accomplish is to have a 3rd person camera, sort of like roblox’s camera, then its kinda simple:

``````        //CAMERA

if (Input.GetAxis("Mouse ScrollWheel") > 0f & Scroll - .5f > .25f)
{
Scroll = Scroll - .25f;
}
else if (Input.GetAxis("Mouse ScrollWheel") < 0f & Scroll + .5f < 5)
{
Scroll = Scroll + .25f;
}
if (Input.GetKey(KeyCode.Mouse1))
{
Camera0.transform.position = RootPart.transform.position + new Vector3(0, 1, 0);
Camera0.transform.rotation = Quaternion.Euler(Camera0.transform.rotation.eulerAngles.x + -Input.GetAxis("Mouse Y") * 3, Camera0.transform.rotation.eulerAngles.y + Input.GetAxis("Mouse X") * 3, Camera0.transform.rotation.eulerAngles.z);
}
Camera0.transform.position = RootPart.transform.position + new Vector3(0, 1, 0);
Camera0.transform.position = Camera0.transform.position + Camera0.transform.forward * -Scroll;
``````

This should work if you do these things:

1. Set the “RootPart” variable as a GameObject that you want it to pivot to
2. Set the “Camera0” variable to your MainCamera that you want to use
3. Add a variable for “Scroll” somewhere in the script

Basically, what this does is it lets you rotate around your “RootPart” and let you use the scroll wheel to scroll, and the Mouse1(right click hold) to rotate the camera
@Amberlewis012