I want to have a camera, that follow the player, without childing it to the player object. So far I have this one line, that follows the player, but does not rotate with it (meaning the camera should look where the player's front is looking, how can I do it?
transform.position = player.transform.position + offset;
Answer
Something like this:
transform.position = player.transform.position - player.transform.forward * distance;
transform.LookAt(player.transform);
where float distance is the distance of camera form player
Consider also the solution 2 : Make camera child of player and in your player die script , you can "deatach" camera from player object
transform.parent = null;
No comments:
Post a Comment