unity first person create game code example
Example: first person view unity
// C Sharp
public Transform followTarget;
public Vector3 targetOffset;
public float moveSpeed = 2f;
private Transform myTransform;
void Start(){
myTransform = transform;
}
public void SetTarget(Transfrom aTransform){
followTarget = aTransform;
}
void LateUpdate(){
if(followTarget != null){
myTransform.position = Vector3.Lerp(myTransform.position, followTarget.position + targetOffset, moveSpeed * Time.deltaTime);
}
}