So I’m working on a script that allows the player to enter a vehicle. To do this I have camera called carcam which uses the smoothfollow script and what i need to do is activate this camera and script and set the target to the car which has been found earlier, unfortunately I’m hitting a bunch of errors that I don’t understand
void Update () {
if (Input.GetKeyDown (KeyCode.E)) {
Collider[] collider = Physics.OverlapSphere(transform.position,10);
foreach( Collider c in collider)
{
print(c.name);
if (c.tag == "car")
{
c.enabled = true;
GetComponent<MouseLook>().enabled = false;
GetComponent<CharacterController>().enabled = false;
GetComponent<Camera>().enabled = false;
GameObject g = GameObject.Find("carcam");
g.GetComponent("SmoothFollow").enabled = true;
}
}
}
}