Hello, i would like this script to follow the rotation of the Target, just not only the position. What do i need to add? Also it needs to only rotate on 2 axis only.
using UnityEngine;
using System.Collections;
public class CamerFollow2 : MonoBehaviour {
public Transform Target;
void LateUpdate ()
{
transform.position = new Vector3(Target.position.x, transform.position.y, Target.position.z);
}
}
As the documentation says, the parameters are: Rotate (xAngle : float, yAngle : float, zAngle : float, relativeTo : Space = Space.Self). If you do not want to rotate in a specific angle, just set the parameter to 0.
using UnityEngine;
using System.Collections;
public class CamerFollow2 : MonoBehaviour {
public Transform Target;
void LateUpdate ()
{
transform.position = new Vector3(Target.position.x, transform.position.y, Target.position.z);
transform.rotate = (Target.eulerAngles.x, Target.eulerAngles.y, Target.eulerAngles.z); //I belive? not too sure tbh
}
}