public static float Velocity() { float velocity = (DialControl.Position() - lastPos) / Time.deltaTime; lastPos = DialControl.Position(); return(velocity); }
void Rotate(bool limitRotation) { if (!limitRotation) { position = DialControl.Position() * sensitivity; } else { position = DialControl.ClampedPosition(position * sensitivity, minRotation, maxRotation); } Quaternion rotation = this.transform.rotation; rotation.eulerAngles = new Vector3(rotation.eulerAngles.x, rotation.eulerAngles.y, position + offsetPos); this.transform.rotation = Quaternion.Lerp(this.transform.rotation, rotation, speed * Time.deltaTime); }
// Update is called once per frame void Update() { position = DialControl.ClampedPosition(position, minPossAntennaPos, maxPossAntennaPos); if (clampPosition) { if (position < (antennaNeededAntennaPosition + 2) && position > (antennaNeededAntennaPosition - 2)) { antennaInPosition = true; anim.SetTrigger("Pan Down"); } } else { if (DialControl.Position() < (antennaNeededAntennaPosition + 2) && DialControl.Position() > (antennaNeededAntennaPosition - 2)) { antennaInPosition = true; anim.SetTrigger("Pan Down"); } } }