# How do I get my mouse (and first person camera) to multiply by deltatime?

I have a pause menu in my game, and I want my camera to stop when I hit escape to bring it up. When the pause menu is active, the timescale is set to zero, so everything should stop. However, the camera still moves, and I was told this is the case because my mouse/camera are not influenced by deltatime. Here is the line of code I’ve been told is causing the issue:

``````                 //Don't multiply mouse input by Time.deltaTime
float deltaTimeMultiplier = IsCurrentDeviceMouse ? 1.0f : Time.deltaTime;
``````

How should I change this to make it so that the mouse is influenced by deltatime? If that’s not the issue, what should I fix instead? I’m very new to all of this, so thank you for any help you are able to give me!

Hello, You can’t do anything about it with delta time.

You should use conditions like if (pauseMenuIsActivated == true)

for example:

``````public float lookSpeed = 3;
private Vector2 rotation = Vector2.zero;

some void
{
if (pauseMenuActivated == false)  // condition
{
rotation.y += Input.GetAxis("Mouse X");
rotation.x += -Input.GetAxis("Mouse Y");
rotation.x = Mathf.Clamp(rotation.x, -15f, 15f);
transform.eulerAngles = new Vector2(0,rotation.y) * lookSpeed;
Camera.main.transform.localRotation = Quaternion.Euler(rotation.x
* lookSpeed, 0, 0);
}
}
``````

If you are only using the mouse to move the camera then you have an essentially intuitive piece of code that causes you this problem
I do not yet have the skills to intervene in case I was using an external pad but in this case it was not so I suggest you modify this portion of code in your script where the rotation of the camera is present

The rest leave it as in this thread and it should work. https://answers.unity.com/questions/1906887/player-camera-still-moving-when-paused.html?childToView=1906903#comment-1906903

Game paused >> Camera stopped

``````private void CameraRotation()
{
// if there is an input
if (_input.look.sqrMagnitude >= _threshold)
{
//I deleted the useless deltaMultipler and multiply the rotation with deltatime

_cinemachineTargetPitch += _input.look.y * RotationSpeed * Time.deltaTime;
_rotationVelocity = _input.look.x * RotationSpeed * Time.deltaTime;

// clamp our pitch rotation
_cinemachineTargetPitch = ClampAngle(_cinemachineTargetPitch, BottomClamp, TopClamp);

// Update Cinemachine camera target pitch
CinemachineCameraTarget.transform.localRotation = Quaternion.Euler(_cinemachineTargetPitch, 0.0f, 0.0f);

// rotate the player left and right
transform.Rotate(Vector3.up * _rotationVelocity);
}
``````