I tried to make a Camera Follow script. The first thing i did was to set the position of the camera to the players position.
But when the game started the camera changed position to where the player was at the beginning of the game but remained there. The FollowTransform.position only returned the initial position of the player. What did I do wrong?
asked May 08 '12 at 04:10 PM
You can set the camera as a parent to your game object. That way it will "follow" your game object.
i.e. var FollowTransform : Transform = (follow.gameObject.GetComponent(Transform)); transform.parent = FollowTransform;
You can adjust the position and rotation of the camera, in relation to the game object, using localPosition and localRotation.
answered May 08 '12 at 04:58 PM