Error in script?
Hello? I just wanted to ask about an error in this script. Could you guys tell me what's wrong? (It's a script to move a camera attached to it).
#pragma strict
var player = GetComponent.<GameObject>();
var offset;
function Awake() {
offset = player.transform.position - transform.position;
}
function Update () {
transform.position = player.transform.position + offset;
}
and i get this errror: Assets/Scripts/Camera Control.js(8,48): BCE0051: Operator '+' cannot be used with a left hand side of type 'UnityEngine.Vector3' and a right hand side of type 'Object'.
i've dug down a little deeper and now transform.position in line 5 gives me an object instead of a vector3!
Your answer
Follow this Question
Related Questions
Camerashake doesn´t work expected in Build c# 0 Answers
Transform.RotateAround not rotating around specified game object. 0 Answers
transform.position not applying to my camera. 1 Answer
How to change camera position on trigger while camera is being updated each frame by LateUpdate 0 Answers
How to change the camera background colour with player height. 1 Answer