The camera isn't moving correctly in my custom input

Hi. I’m currently creating a custom camera input.

It can be moved with the WASD keys, and the viewpoint can be rotated by dragging the mouse.

Since this input class itself does not interact with the DOM, it has the advantage of being usable inside a Web Worker as well.

However, while it works correctly when only moving with WASD, there are some bugs when moving while changing the view with the mouse. For example, even though I’m pressing W, the camera may move sideways instead of forward, or when pressing W and D at the same time, the movement speed becomes faster only in the sideways direction.

Please feel free to try it in the playground:
https://playground.babylonjs.com/#9H2V2O

Is there something wrong with my calculations?

I would appreciate any advice.

Thanks!

Update: The issue was mitigated by setting the camera’s sensitivity to a higher value, so the problem is likely caused by the camera’s movement speed being too slow.

maybe related: Even when I provide a small vector to the `cameraDirection` of a camera with `checkCollision`, it doesn't work - #4 by syuilo

(But in this playground, does not use checkCollision)

That said, depending on the situation, it may not be possible to increase the sensitivity, so I am continuing to investigate the cause and look for solutions other than increasing the sensitivity.