private void InputHandler_LeftStickChanged(object sender, AnalogStickChangedEventArgs e) { var forward = MathHelper.RotationToDirection(CurrentEntity.Rotation); if (e.X > sbyte.MaxValue) { _previousPos -= (forward.RightVector(new Vector3(0, 0, 1f)) * (Function.Call <float>(Hash.GET_CONTROL_NORMAL, 2, 218) * -4f) * _moveScale); } if (e.X < sbyte.MaxValue) { _previousPos += -forward.RightVector(new Vector3(0, 0, 1f)) * (Function.Call <float>(Hash.GET_CONTROL_NORMAL, 2, 218) * -4f * _moveScale); } if (e.Y != sbyte.MaxValue) { _previousPos += forward * (Function.Call <float>(Hash.GET_CONTROL_NORMAL, 0, 8) * -5f * _moveScale); } _currentLerpTime += 0.001f; if (_currentLerpTime > LerpTime) { _currentLerpTime = LerpTime; } CurrentEntity.Position = Vector3.Lerp(CurrentEntity.Position, _previousPos, _currentLerpTime / LerpTime); }
private void LeftStickChanged(object sender, AnalogStickChangedEventArgs e) { if (e.X > sbyte.MaxValue) { _previousPos -= Utils.RotationToDirection(MainCamera.Rotation).RightVector(new Vector3(0, 0, 1f)) * (Function.Call <float>(Hash.GET_CONTROL_NORMAL, 2, 218) * -3f); } if (e.X < sbyte.MaxValue) { _previousPos += Utils.RotationToDirection(MainCamera.Rotation).LeftVector(new Vector3(0, 0, 1f)) * (Function.Call <float>(Hash.GET_CONTROL_NORMAL, 2, 218) * -3f); } if (e.Y != sbyte.MaxValue) { _previousPos += Utils.RotationToDirection(MainCamera.Rotation) * (Function.Call <float>(Hash.GET_CONTROL_NORMAL, 0, 8) * -5f); } _currentLerpTime += 0.02f; if (_currentLerpTime > LerpTime) { _currentLerpTime = LerpTime; } float amount = _currentLerpTime / LerpTime; _mainCamera.Position = Vector3.Lerp(MainCamera.Position, _previousPos, amount); }
private void LeftStickChanged(object sender, AnalogStickChangedEventArgs e) { if (!IsActive || DisableControls || _mainCamera.IsInterpolating) { return; } if (e.X > sbyte.MaxValue) { _previousPos -= Direction.RightVector(new Vector3(0, 0, 1f)) * (Function.Call <float>(Hash.GET_CONTROL_NORMAL, 2, 218) * -3f) * _moveScale; } if (e.X < sbyte.MaxValue) { _previousPos += -Direction.RightVector(new Vector3(0, 0, 1f)) * (Function.Call <float>(Hash.GET_CONTROL_NORMAL, 2, 218) * -3f) * _moveScale; } if (e.Y != sbyte.MaxValue) { _previousPos += Direction * Function.Call <float>(Hash.GET_CONTROL_NORMAL, 0, 8) * -5f * _moveScale; } _currentLerpTime += 0.2f; if (_currentLerpTime > LerpTime) { _currentLerpTime = LerpTime; } _desiredPos = Vector3.Lerp(_mainCamera.Position, _previousPos, 0.2f); }
private void RightStickChanged(object sender, AnalogStickChangedEventArgs e) { if (_mainCamera.IsInterpolating || !IsActive || DisableControls) { return; } _mainCamera.Rotation += new Vector3(Function.Call <float>(Hash.GET_CONTROL_NORMAL, 2, 221) * -10f, 0, Function.Call <float>(Hash.GET_CONTROL_NORMAL, 2, 220) * -11f) * RotationSpeed; }
private void GamepadHandler_RightStickChanged(object sender, AnalogStickChangedEventArgs e) { newRotation = Rotation + (new Vector3(Function.Call <float>(Hash.GET_CONTROL_NORMAL, 2, 221) * -4f, 0, Function.Call <float>(Hash.GET_CONTROL_NORMAL, 2, 220) * -5f) * 4.0f); newRotation = Vector3.Clamp(newRotation, new Vector3(-170.0f, newRotation.Y, newRotation.Z), new Vector3(-10.0f, newRotation.Y, newRotation.Z)); startTime = Game.GameTime; /* if (Rotation.Y >= 60.0) * Rotation = new Vector3(Rotation.X, 90.0F, Rotation.Z); * else if (Rotation.Y <= -90.0f) * Rotation = new Vector3(Rotation.X, -90.0f, Rotation.Z);*/ }
private void RightStickChanged(object sender, AnalogStickChangedEventArgs e) { MainCamera.Rotation += new Vector3(Function.Call <float>(Hash.GET_CONTROL_NORMAL, 2, 221) * -4f, 0, Function.Call <float>(Hash.GET_CONTROL_NORMAL, 2, 220) * -5f) * RotationSpeed; }