- Home /
Camera will not follow character in any project or with any script.
What exactly is wrong with my camera? I use Mecanim Tute and follow the video tutorial exactly and I get absolutely no camera following the player character. My friend allowed me to use some of his assets from the Character System for Mecanim for testing and even then I get no camera movement to follow the character in game view or game playing. Is this because I don't have Pro or is this something else? I use Unity Free just so you all know.
Download the S$$anonymous$$lth project and open it up in Unity to see if the camera follows the player. If it does, then you are doing something wrong, probably placement of the script and referencing other gameobjects.
S$$anonymous$$lth 01 works but it doesn't point out exactly help my question. I'm still unsure as to what is causing the problem as when I open the premade $$anonymous$$ecanim tutorial scenes the camera still refuses to follow the character properly.
It's user made so there might be a problem. Without seeing the code or inspector/scene it's hard to tell.
Here's the code for the Third Person Cam for the $$anonymous$$ecanim Tutorial. The code for Character System camera is really long and I can't comment it.
using UnityEngine;
using System.Collections;
public class ThirdPersonCamera : $$anonymous$$onoBehaviour
{
public float smooth = 3f; // a public variable to adjust smoothing of camera motion
Transform standardPos; // the usual position for the camera, specified by a transform in the game
Transform lookAtPos; // the position to move the camera to when using head look
void Start()
{
// initialising references
standardPos = GameObject.Find ("CamPos").transform;
if(GameObject.Find ("LookAtPos"))
lookAtPos = GameObject.Find ("LookAtPos").transform;
}
void FixedUpdate ()
{
// if we hold Alt
if(Input.GetButton("Fire2") && lookAtPos)
{
// lerp the camera position to the look at position, and lerp its forward direction to match
transform.position = Vector3.Lerp(transform.position, lookAtPos.position, Time.deltaTime * smooth);
transform.forward = Vector3.Lerp(transform.forward, lookAtPos.forward, Time.deltaTime * smooth);
}
else
{
// return the camera to standard position and direction
transform.position = Vector3.Lerp(transform.position, standardPos.position, Time.deltaTime * smooth);
transform.forward = Vector3.Lerp(transform.forward, standardPos.forward, Time.deltaTime * smooth);
}
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613121112im_/https://answers.unity.com/themes/thub/images/avi.jpg)