# Make camera follow and rotate with player without childing it

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;

• Why don't you want to parent the camera to the player? – Vadim Tatarnikov Jul 30 '15 at 7:40
• because if the player dies (gets destroyed) the camera will go with it. I want to make it like some game, where you die, and the camera stays at your corpse for a while, before respawning and the camera gets back to you – Borislav Jul 30 '15 at 7:41
• Just don't destroy the player, play an animation or disable the mesh renderer or collider. – Vadim Tatarnikov Jul 30 '15 at 7:44
• In your die script , you can "deatach" camera from player object – dnk drone.vs.drones Jul 30 '15 at 7:44
• yes, but I need to know how can I make it this way – Borislav Jul 30 '15 at 7:46

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;

• the code doesn't work, because the camera slowly goes to the player, and then goes inside of him, then out, and its all very weird... – Borislav Jul 30 '15 at 8:01
• still the same, also you can't use multiplications in Vector3 – Borislav Jul 30 '15 at 8:07
• edited , ofset changed in float distance – dnk drone.vs.drones Jul 30 '15 at 8:19

You can multiply vector3 by using vector3.cross(vector a, vector b);

And here, its not multiplying to vector3. Its multiplying to just z axis. Transform.forward is z axis.