xeolabs / xeogl

A WebGL-based 3D engine for technical visualization. Not actively maintained.
http://xeogl.org
Other
1.15k stars 264 forks source link

Camera panning with keyboard is wrong #311

Closed Swaggaaa closed 5 years ago

Swaggaaa commented 5 years ago

Describe the bug Keyboard panning is incorrectly implemented. Front / back panning works fine, but right / left and up / down does not. If we take a look at the code: https://github.com/xeolabs/xeogl/blob/e2eb6c626f7b65477d421aa5cc2c7c4c5f0e45ea/src/controls/cameraControl.js#L1111-L1127

We can see how the plus and minus signs are kinda mixed together.

To Reproduce Steps to reproduce the behavior:

  1. Go to http://xeogl.org/examples/#importing_gltf_AdamHead
  2. Considering a QWERTY keyboard layout:
    • W / S should work just fine.
    • D should pan at a faster rate than A.
    • Z / X should both pan vertically up.

Expected behavior W should go forward. S should go backwards. A should pan to the left at the same speed as D pans to the right. Z should go upwards. X should go downwards.

Desktop (please complete the following information):

Additional context This problem should be present in any xeo.gl example that doesn't override the default keyboard panning behaviour.