I have a object (a sphere) using a rigidbody controller to move and if i put the main camera as a child of the player but the camera rotates. I tried various solutions not containing code (i am bad at code) but i can’t find something that works.,I have a rigidbody object (a sphere) that you can move by using WASD and when i attach the camera to my player it rotates cause my Player uses a rigidbody and it is a sphere. I tried various solutions that don’t need me writing code (i am bad at code) but i cant find a way.
You can simply make the camera follow the player gameobject instead of making it a child. On the camera Gameobject, in Late Update (so that the player moves first), make the camera’s position = player position + offset. The offset will be a Vector3 that is set at an offset where you want the camera to be.
What I often do with cameras is make them follow a separate target gameobject that follows the player gameobject. This allows for you to make the target instead follow at a certain speed or acceleration, which gives camera smoothing.
In the rigidbody component, just click the dropdown to “Constraints” and click on all the rotation ones, or all of them but Y if you want to be able to look side to side. Hope it helps! Please “Accept Answer” if it does!