Exemple #1
0
        public void CalculateXRotationShouldNotReturnAEulerAngleXGreaterThan90()
        {
            float          mouseY         = 1f;
            float          deltaTime      = -9.1f;
            CameraRotation CameraRotation = new CameraRotation(10f);

            Assert.LessOrEqual(CameraRotation.CalculateXRotation(mouseY, deltaTime).eulerAngles.x, 90);
        }
Exemple #2
0
        public void CalculateXRotationShouldReturnExpectedRotation()
        {
            float          mouseY         = 1f;
            float          deltaTime      = 1f;
            CameraRotation CameraRotation = new CameraRotation(10f);
            Quaternion     expected       = Quaternion.Euler(-10f, 0, 0);

            Assert.AreEqual(expected, CameraRotation.CalculateXRotation(mouseY, deltaTime));
        }
Exemple #3
0
 void Update()
 {
     transform.localRotation = CameraRotation.CalculateXRotation(_playerInput.GetAxis("Mouse Y"), _playerInput.GetDeltaTime());
 }