I am working on a driving game, and I need the camera to follow the car’s position and rotation. Currently, this code is only partially working. Also, this script is in the car object, not the camera.
followCam.transform.position = transform.position+ new Vector3(0f,12f,0f) + Vector3.back*20f; followCam.transform.rotation = Quaternion.identity; followCam.transform.Rotate(13,this.transform.rotation.y,this.transform.rotation.z);
The first line is supposed to move the camera about 12 units above the position of the car, and 20 units behind it. This all works, except the camera is moved 20 units behind the car in world space, not local space, like this:
When it should look like this:
The second problem is that the camera is not rotating, when it should have the exact rotation that the car has.