// Update is called once per frame void Update() { var currError = Target.position - Source.position; if (currError.magnitude < 0.01f) { return; } var error = 0; mPidController.AddSample(error); var output = mPidController.GetLastOutput(); }