Camera not being set where it should be

I have a game camera that is in a sky view until a clients connects and wants to use the camera on their player. In On Start Local Player I’m setting the parent of the camera to the player that spawns and setting a fixed position and rotation behind the player. The value I’ve hardcoded is not the same value the inspector is showing.

The initial values of the camera are:
position = (0, 8.15, -14)
rotation = (35, 0, 0)

After I parent the camera to a player I then set those values to:
position = (0, 1.5, -1.35)
rotation = (25, 0, 0)

What I actually get are values:
position = (0.5903, 0.1799, 11.1219)
rotation = (25, -132.58, 0)

public override void OnStartLocalPlayer(){
//base.OnStartLocalPlayer();

//camSpecPos = cam.transform.position;
//camSpecRot = cam.transform.rotation;

cam.transform.parent = transform;

cam.transform.position = new Vector3(0, 1.5f, -1.35f);
cam.transform.rotation = Quaternion.Euler(25, 0, 0);
}

try maybe: cam.transform.localPosition/localRotation (I think you see local values in the inspector when it’s a child).

1 Like

Yes, the values you see in the inspector are equivalent to .localPosition and .localRotation.

Thanks. That’s one mystery solved.