Okay, so my player is a ship, and he rotates left and right as you move him left, or right. What I want to do is rotate the camera with the player, without having to child the camera to the player (because I have a really nice smooth follow script on the camera, that I would really like to keep). I can’t seem to figure out what is wrong with the script, though… There’s probably an easier way to do this, but I haven’t been able to find a function in the script reference that would make it easier… Here’s the smooth camera follow script (the camera rotate is in the LateUpdate() function, as I’ve heard it should be):

```
#pragma strict
var target : Transform;
var smoothTime = 0.1; //Default Smooth Time = 0.3
var startXRotation = 350f;
private var thisTransform : Transform;
private var velocity : Vector3;
private var startRotation: Quaternion;
private var leftRotation: Quaternion;
private var rightRotation: Quaternion;
function Awake(){
target = GameObject.FindWithTag("Player").transform;
transform.rotation = Quaternion.Euler(new Vector3(startXRotation,0,0));
startRotation = transform.rotation;
leftRotation = Quaternion.Euler(new Vector3(startXRotation,0,7.5f));
rightRotation = Quaternion.Euler(new Vector3(startXRotation,0,-7.5f));
}
function Start()
{
thisTransform = transform;
}
function Update()
{
if(Time.timeScale < 1.0f)
{
smoothTime = 0.05;
}
else if(Time.timeScale == 1.0f)
{
smoothTime = 0.1f;
}
//controls the camera follow on the X axis. This directly corrolates to the player characters movement.
thisTransform.position.x = Mathf.SmoothDamp(thisTransform.position.x, target.position.x, velocity.x, smoothTime);
//controls the camera rotation on the Z axis. This directly corrolates to the player characters rotation.
thisTransform.rotation.z = Mathf.SmoothDamp(thisTransform.rotation.z, target.rotation.z, velocity.z, smoothTime);
}
function LateUpdate(){
if(Input.acceleration.x < -0.1f Time.timeScale!=0)
{
transform.rotation = Quaternion.Slerp(startRotation,leftRotation, Time.deltaTime * smoothTime);
}
else if (Input.acceleration.x > -0.1f Input.acceleration.x < 0.1f Time.timeScale!=0)
{
transform.rotation = Quaternion.Slerp(transform.rotation,startRotation, Time.deltaTime * smoothTime);
}
if(Input.acceleration.x > 0.1f Time.timeScale!=0)
{
transform.rotation = Quaternion.Slerp(startRotation,rightRotation, Time.deltaTime * smoothTime);
}
else if (Input.acceleration.x > -0.1f Input.acceleration.x < 0.1f Time.timeScale!=0)
{
transform.rotation = Quaternion.Slerp(transform.rotation,startRotation, Time.deltaTime * smoothTime);
}
}
```

The PlayerRotate script has the same exact parameters, but it would be nice to figure out how to rotate it WITH the player, and not just at the same exact rate as the player… Plus, it doesn’t rotate at all… I have been scouring the script reference for about 2 hours now trying to find a different function to use, and it’s just not working…