fix camera for capturing

This commit is contained in:
nlitkowski 2021-12-20 00:10:31 +01:00
parent 3bcb8efaff
commit 34f1c3523e

View File

@ -202,12 +202,15 @@ public class Main : MonoBehaviour
[System.Diagnostics.CodeAnalysis.SuppressMessage("CodeQuality", "IDE0051:Remove unused private members", Justification = "Unity method")] [System.Diagnostics.CodeAnalysis.SuppressMessage("CodeQuality", "IDE0051:Remove unused private members", Justification = "Unity method")]
void Update() void Update()
{ {
mainCamera.GetComponent<Camera>().fieldOfView = m_FieldOfView; Vector3 lookAt = new Vector3(500f + m_camLookAtX, 1f + m_camLookAtY, 500f + m_camLookAtZ);
newCameraPosX = m_CameraR * Mathf.Cos(camera_rotation) + 500f + m_camPosX; newCameraPosX = m_CameraR * Mathf.Cos(camera_rotation) + 500f + m_camPosX;
newCameraPosY = 10f + m_camPosY; newCameraPosY = 10f + m_camPosY;
newCameraPosZ = m_CameraR * Mathf.Sin(camera_rotation) + 500f + m_camPosZ; newCameraPosZ = m_CameraR * Mathf.Sin(camera_rotation) + 500f + m_camPosZ;
mainCamera.GetComponent<Camera>().transform.position = new Vector3(newCameraPosX, newCameraPosY, newCameraPosZ); Vector3 pos = new Vector3(newCameraPosX, newCameraPosY, newCameraPosZ);
mainCamera.GetComponent<Camera>().transform.LookAt(new Vector3(500f + m_camLookAtX, 1f + m_camLookAtY, 500f + m_camLookAtZ));
mainCamera.GetComponent<Camera>().fieldOfView = m_FieldOfView;
mainCamera.GetComponent<Camera>().transform.position = pos;
mainCamera.GetComponent<Camera>().transform.LookAt(lookAt);
camera_rotation += 0.001f; camera_rotation += 0.001f;
if (m_TreesXShift != 0.0f || m_TreesZShift != 0.0f) if (m_TreesXShift != 0.0f || m_TreesZShift != 0.0f)
@ -228,7 +231,7 @@ public class Main : MonoBehaviour
textureCamera.GetComponent<Camera>().fieldOfView = m_FieldOfView; textureCamera.GetComponent<Camera>().fieldOfView = m_FieldOfView;
textureCamera.GetComponent<Camera>().transform.position = new Vector3(newCameraPosX, newCameraPosY, newCameraPosZ); textureCamera.GetComponent<Camera>().transform.position = new Vector3(newCameraPosX, newCameraPosY, newCameraPosZ);
textureCamera.GetComponent<Camera>().transform.LookAt(new Vector3(500f + m_camLookAtX, 1f + m_camLookAtY, 500f + m_camLookAtZ)); textureCamera.GetComponent<Camera>().transform.LookAt(new Vector3(500f + m_camLookAtX, 1f + m_camLookAtY, 500f + m_camLookAtZ));
textureCamera.transform.RotateAround(new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f), 1); //textureCamera.transform.RotateAround(new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f), 1);
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("CodeQuality", "IDE0051:Remove unused private members", Justification = "Unity method")] [System.Diagnostics.CodeAnalysis.SuppressMessage("CodeQuality", "IDE0051:Remove unused private members", Justification = "Unity method")]