Hello,
public GameObject player;
private Vector3 offsetLoc;
private Vector3 offsetRot;
void Start () {
offsetLoc = transform.position - player.transform.position;
offsetRot = transform.rotation - player.transform.rotation;
}
void LateUpdate () {
transform.position = player.transform.position + offsetLoc;
transform.rotation = player.transform.rotation + offsetRot;
}
I have got problem with substracting transform.rotation. I allways get error:
Operator -' cannot be applied to operands of type
UnityEngine.Quaternion’ and `UnityEngine.Quaternion’
How can I fix it?
Sorry for my bad english.
Thanks.