// Update is called once per frame void Update() { if (!onRide) { if (Vector3.Distance(transform.position, player.transform.position) < minCarDistance && Input.GetButtonDown(ioKey)) { playerMove.overridePosition(seatsBase[FL].transform); playerMove.toggleColDetect(); playerMove.seat(transform.forward); player.SendMessage("deactivate"); mainCamera.changeTarget(gameObject); onRide = true; } } else { move(); if (Input.GetButtonDown(ioKey)) { playerMove.freePosition(transform.position + (transform.right * outPositon)); playerMove.toggleColDetect(); player.SendMessage("activate"); mainCamera.resetTarget(); onRide = false; } } }