I was unable to find a ready code snippet for the specific camera behavior I wanted. So here you go:
Camera control is basically like in every modern strategy or turn-based game:
- Move the camera with WASD- or arrow keys. “Move” here means a 2D displacement along the BABYLON x and z axis. I think this is called panning.
- Holding down any mouse button rotates the camera like a normal ArcRotateCamera.
In other words, the code snippet offers a movable ArcRotateCamera.
The move code was the cleanest I could find (see credits in code) and avoids spawning an extra TransformNode. I extend the regular Babylon keyboard plugin (src) so that I only have to take care of the checkInputs() method. See also docs.
Any feedback much appreciated.