public void HandleCameraView() { if (pluginSettings.ready) { // Call the camera's behavior. currentCamera.ApplyBehavior(ref cameraPositionTarget, ref cameraLookAtTarget, player, isCameraStatic); isCameraStatic = currentCamera.staticCamera; if (currentAvatar != null) { if (pluginSettings.removeAvatarInsteadOfHead) { currentAvatar.avatarSettings.showAvatar.Value = !currentCamera.removeHead; } else { currentAvatar.avatarSettings.showAvatarHead.Value = !currentCamera.removeHead; } timerHelper.ResetRemoveAvatarTimer(); } cameraPosition = Vector3.SmoothDamp(cameraPosition, cameraPositionTarget, ref cameraVelocity, currentCamera.GetBetweenTime()); cameraLookAt = Vector3.SmoothDamp(cameraLookAt, cameraLookAtTarget, ref cameraLookAtVelocity, currentCamera.GetBetweenTime()); Vector3 lookDirection = cameraLookAt - cameraPosition; Quaternion rotation = currentCamera.GetRotation(lookDirection, player); cameraHelper.UpdateCameraPose(cameraPosition, rotation, currentCamera.GetFOV()); } }
public override Quaternion GetRotation(Vector3 lookDirection, LivPlayerEntity player) { return(Quaternion.Slerp(Quaternion.LookRotation(player.head.forward, player.head.up), sightsCamera.GetRotation(lookDirection, player), blend)); }