How can I move by ArcRotateCamera like UniversalCamera in this example:
https://playground.babylonjs.com/#CTCSWQ#1
Here is the example with 2 ArcRotate cameras - https://www.babylonjs-playground.com/#SVZL1I#35
Maybe you don’t understand what I mean
Because of the project item, what I want is to change the keyboard function as shown in the link: https://playground.babylonjs.com/#CTCSWQ#1
But I want to apply for ArcRotateCamera
There are some problems with this bellow code:
FreeCameraKeyboardWalkInput.prototype.checkInputs = function () {
if (this._onKeyDown) {
var camera = this.camera;
for (var index = 0; index < this._keys.length; index++) {
var keyCode = this._keys[index];
var speed = camera.speed;
if (this.keysLeft.indexOf(keyCode) !== -1) {
camera.rotation.y -= camera.angularSpeed;
camera.direction.copyFromFloats(0, 0, 0);
}
else if (this.keysUp.indexOf(keyCode) !== -1) {
camera.direction.copyFromFloats(0, 0, speed);
}
else if (this.keysRight.indexOf(keyCode) !== -1) {
camera.rotation.y += camera.angularSpeed;
camera.direction.copyFromFloats(0, 0, 0);
}
else if (this.keysDown.indexOf(keyCode) !== -1) {
camera.direction.copyFromFloats(0, 0, -speed);
}
if (camera.getScene().useRightHandedSystem) {
camera.direction.z *= -1;
}
camera.getViewMatrix().invertToRef(camera._cameraTransformMatrix);
BABYLON.Vector3.TransformNormalToRef(camera.direction, camera._cameraTransformMatrix, camera._transformedDirection);
camera.cameraDirection.addInPlace(camera._transformedDirection);
}
}
};
The PG you give comes from the docs Customizing Camera Inputs | Babylon.js Documentation showing an example of creating your own input controls for a camera.
This PG https://playground.babylonjs.com/#SQFG0Q#6 shows an arcrotate camera moving. You might be able to use the technique.
EDIT missing PG added
I have found the cause, it looks like this function: camera.cameraDirection.addInPlace doesn’t work correctly with ArcRotateCamera.