I have a setup in unity using Graphics.DrawMesh() to draw a mesh on my players camera location in the update loop,
Graphics.DrawMesh(viewModel, matrix, material, layer, null, 0);
matrix = Matrix4x4.TRS(cam.transform.position, cam.transform.rotation, scaleFps);
when I use my mouse to move around the camera, it lags behind where the camera is, as can be seen in the video. I have no idea how to fix this. I've tried not using the matrix, and it doesn't change anything.
Here's the script I use for moving the camera:
//Get the current mouse input. yaw += Input.GetAxis("Mouse X") * mouseSensitivity; pitch -= Input.GetAxis("Mouse Y") * mouseSensitivity; //Clamp the camera rotation. pitch = Mathf.Clamp(pitch, -maxLookAngle, maxLookAngle); //Calculate and rotate the camera. currentRotation = Vector3.SmoothDamp(currentRotation, new Vector3(pitch, yaw), ref rotationSmoothVelocity, mouseSmoothScale); //Rotating the player. Vector3 bodyRotation = new Vector3(0, currentRotation.y, 0); transform.localEulerAngles = bodyRotation; //Rotating the camera. Vector3 cameraRotation = new Vector3(currentRotation.x, 0, currentRotation.z); playerCamera.transform.localEulerAngles = cameraRotation;'