I have a camera follow script which is attached to the main camera and it follows the players position and rotation. The player needs to be near the top of the screen. However when I hit play, the player is shown at the center of the screen. This is how it looks in the scene view and this is how it should reflect when I hit play. Here the "y" position is -2 and "x" rotation is 0.
But when I press play, the "y" position is still -2 but "x" rotation changes to -14.9. And the player is shown at the center of the screen and not near the top.
Here is the camera follow script:
[SerializeField] Transform target;
public Vector3 defaultDist;
[SerializeField] float distDamp = .1f;
public Vector3 velocity = Vector3.one;
Transform myT;
void Awake()
{
myT = transform;
}
void LateUpdate()
{
SmoothFollow();
}
void SmoothFollow()
{
Vector3 toPos = target.position + (target.rotation * defaultDist);
Vector3 curPos = Vector3.SmoothDamp(myT.position, toPos,ref velocity ,distDamp);
myT.position = curPos ;
myT.LookAt(target, target.up);
}
}
After I hit play, I want the x rotation to stay at 0 and the player to be shown near the top of the screen. Can someone please help?