Hello,
I got my camera as a child of the Player. It has starting Position 0, 1.6, 0.25.
I always render my Player so if I am looking down, I see the human mesh under the shoulders.
Works very well.
When I press “C” the camera Switches a boolean value and is a 3rd Person camera now.
I am changing the Position of the camera in this case (behind the Player but a bit higher) and use transform.LookAt (target); to have my Player centered.
When I Switch back to 1st person, I reset the Position. But now the camera is behind or inside the head, or sometimes right of it etc.
Can anybody tell me what am I missing here?
} else if (Input.GetKeyDown (“c”))
{
Globals.Camera3rdPerson = !Globals.Camera3rdPerson;
if (Globals.Camera3rdPerson)
{
Camera.main.fieldOfView = 100;
Camera.main.transform.rotation = Globals.PlayerTransform.rotation;
}
else
{
Camera.main.fieldOfView = 96;
Camera.main.transform.position = new Vector3(Globals.PlayerTransform.position.x+0.0f,Globals.PlayerTransform.position.y+1.6f,Globals.PlayerTransform.position.z+0.25f);
Camera.main.transform.rotation = Globals.PlayerTransform.rotation;
Camera.main.transform.position = new Vector3(Globals.PlayerTransform.position.x+0.0f,Globals.PlayerTransform.position.y+1.6f,Globals.PlayerTransform.position.z+0.25f);
}
} else
…
Thanks a lot and have a nice sunday,
Firlefanz