protected override void OnStep() { var p = TestSettings.Camera.transform.position; p.x = _car.GetPosition().X; TestSettings.Camera.transform.position = p; if (Input.GetKeyDown(KeyCode.A)) { _spring1.SetMotorSpeed(_speed); } if (Input.GetKeyDown(KeyCode.S)) { _spring1.SetMotorSpeed(0.0f); } if (Input.GetKeyDown(KeyCode.D)) { _spring1.SetMotorSpeed(-_speed); } if (Input.GetKeyDown(KeyCode.Q)) { _hz = Math.Max(0.0f, _hz - 1.0f); _spring1.SetSpringFrequencyHz(_hz); _spring2.SetSpringFrequencyHz(_hz); } if (Input.GetKeyDown(KeyCode.E)) { _hz += 1.0f; _spring1.SetSpringFrequencyHz(_hz); _spring2.SetSpringFrequencyHz(_hz); } }
/// <inheritdoc /> protected override void PreUpdate() { DrawString("Keys: left = a, brake = s, right = d, hz down = q, hz up = e"); DrawString($"frequency = {_hz} hz, damping ratio = {_zeta}"); var p = MainCamera.transform.position; p.x = _car.GetPosition().X; MainCamera.transform.position = p; if (Input.GetKeyDown(KeyCode.A)) { _spring1.SetMotorSpeed(_speed); } if (Input.GetKeyDown(KeyCode.S)) { _spring1.SetMotorSpeed(0.0f); } if (Input.GetKeyDown(KeyCode.D)) { _spring1.SetMotorSpeed(-_speed); } if (Input.GetKeyDown(KeyCode.Q)) { _hz = Math.Max(0.0f, _hz - 1.0f); _spring1.SetSpringFrequencyHz(_hz); _spring2.SetSpringFrequencyHz(_hz); } if (Input.GetKeyDown(KeyCode.E)) { _hz += 1.0f; _spring1.SetSpringFrequencyHz(_hz); _spring2.SetSpringFrequencyHz(_hz); } }