// Update is called once per frame void Update() { count++; #region Moving Platform Activation var heading = this.transform.position - lever.transform.position; var distance = heading.magnitude; var direction = heading / distance; // This is now the normalized direction. if (heading.sqrMagnitude < 7 * 7) { if (Input.GetKeyDown(KeyCode.E)) { movingPlatform.ChangeTarget(); } } #endregion }