private void UpdateIK() { if (!_enableIK) { _animatorHelper.LeftArmIKWeight = 0; _animatorHelper.RightArmIKWeight = 0; _animatorHelper.LookIKWeight = 0; return; } _animatorHelper.LookIKWeight = 1; AimDirection = AimDirection; _animTorso = _activeRagdoll.AnimatedTorso; _chest = _activeRagdoll.GetAnimatedBone(HumanBodyBones.Spine); ReflectBackwards(); _targetDir2D = Auxiliary.GetFloorProjection(AimDirection); CalculateVerticalPercent(); UpdateLookIK(); UpdateArmsIK(); }
private void UpdateCameraPosRot() { // Improve steep inclinations Vector3 movedLookPoint = _lookPoint.position; if (improveSteepInclinations) { float anglePercent = (_cameraRotation.y - minVerticalAngle) / (maxVerticalAngle - minVerticalAngle); float currentDistance = ((anglePercent * inclinationDistance) - inclinationDistance / 2); movedLookPoint += (Quaternion.Euler(inclinationAngle, 0, 0) * Auxiliary.GetFloorProjection(Camera.transform.forward)) * currentDistance; } // Smooth _smoothedLookPoint = Vector3.Lerp(_smoothedLookPoint, movedLookPoint, smooth ? smoothSpeed * Time.deltaTime : 1); Camera.transform.position = _smoothedLookPoint - (_startDirection * _currentDistance); Camera.transform.RotateAround(_smoothedLookPoint, Vector3.right, _cameraRotation.y); Camera.transform.RotateAround(_smoothedLookPoint, Vector3.up, _cameraRotation.x); Camera.transform.LookAt(_smoothedLookPoint); }