var target:Transform;
var distance:float = 10.0;
var height:float = 5.0;
var smoothTime = 2.5;
function Update ()
{
if(!target)
return;
currentRot = Quaternion(transform.rotation.x, transform.rotation.y, transform.rotation.z, transform.rotation.w);
targetRot = target.rotation;
newRot = Quaternion.Lerp(currentRot, targetRot, smoothTime * Time.deltaTime);
transform.rotation = newRot;
transform.position = target.position - (transform.forward*distance)+(target.up*height);
}
This is the current script i am using. My player rotates in every axis and this script allows the camera to follow behind the character no matter what rotation. When i attached it to my camera it follows my character perfectly. However, the camera is not angled to face the character directly. All i need to do is somehow tweak the camera’s local x rotation so its looking down a tad but i dont know how to go about that with this script.
If anyone could help that would be great
Thanks c:
I am just so lost when it comes to these:
transform.rotation
transform.eulerAngles
transform.localEulerAngles
Quaternion.Euler
Quaternion.EulerAngles
Quaternion’s stupid w value