private void LoadCameraPos() { mainCameraTransform.rotation = oldRotation; mainCamera.SetPos(oldPos); mainCamera.SetTargetPos(oldTargetPos, true); mainCamera.SetDistance(oldDistance, true); Camera.main.fieldOfView = oldFoV; }
void LoadCameraSettings(Maid maid) { if (maid == null || !maid.Visible) { return; } bool autoCam = ExSaveData.GetBool(maid, PluginName, "AutoCameraInitialValue", true); if (autoCam) { return; } float cameraPosX = ExSaveData.GetFloat(maid, PluginName, "CameraPos.x", float.NaN); float cameraPosY = ExSaveData.GetFloat(maid, PluginName, "CameraPos.y", float.NaN); float cameraPosZ = ExSaveData.GetFloat(maid, PluginName, "CameraPos.z", float.NaN); float cameraTargetPosX = ExSaveData.GetFloat(maid, PluginName, "CameraTargetPos.x", float.NaN); float cameraTargetPosY = ExSaveData.GetFloat(maid, PluginName, "CameraTargetPos.y", float.NaN); float cameraTargetPosZ = ExSaveData.GetFloat(maid, PluginName, "CameraTargetPos.z", float.NaN); float cameraDistance = ExSaveData.GetFloat(maid, PluginName, "CameraDistance", float.NaN); float cameraRotatationX = ExSaveData.GetFloat(maid, PluginName, "CameraRotation.x", float.NaN); float cameraRotatationY = ExSaveData.GetFloat(maid, PluginName, "CameraRotation.y", float.NaN); float cameraRotatationZ = ExSaveData.GetFloat(maid, PluginName, "CameraRotation.z", float.NaN); float cameraRotatationW = ExSaveData.GetFloat(maid, PluginName, "CameraRotation.w", float.NaN); float cameraFov = ExSaveData.GetFloat(maid, PluginName, "CameraFov", float.NaN); if (!float.IsNaN(cameraRotatationX) && !float.IsNaN(cameraRotatationY) && !float.IsNaN(cameraRotatationZ) && !float.IsNaN(cameraRotatationW)) { Camera.main.gameObject.transform.rotation = new Quaternion(cameraRotatationX, cameraRotatationY, cameraRotatationZ, cameraRotatationW); } if (!float.IsNaN(cameraPosX) && !float.IsNaN(cameraPosY) && !float.IsNaN(cameraPosZ)) { mainCamera.SetPos(new Vector3(cameraPosX, cameraPosY, cameraPosZ)); } if (!float.IsNaN(cameraTargetPosX) && !float.IsNaN(cameraTargetPosY) && !float.IsNaN(cameraTargetPosZ)) { mainCamera.SetTargetPos(new Vector3(cameraTargetPosX, cameraTargetPosY, cameraTargetPosZ), true); } if (!float.IsNaN(cameraDistance)) { mainCamera.SetDistance(cameraDistance, true); } if (!float.IsNaN(cameraFov)) { Camera.main.fieldOfView = cameraFov; } }