|
@@ -45315,10 +45315,15 @@ var BABYLON;
|
|
LSValues.x = Math.abs(normalizedLX) > 0.005 ? 0 + normalizedLX : 0;
|
|
LSValues.x = Math.abs(normalizedLX) > 0.005 ? 0 + normalizedLX : 0;
|
|
LSValues.y = Math.abs(normalizedLY) > 0.005 ? 0 + normalizedLY : 0;
|
|
LSValues.y = Math.abs(normalizedLY) > 0.005 ? 0 + normalizedLY : 0;
|
|
var RSValues = this.gamepad.rightStick;
|
|
var RSValues = this.gamepad.rightStick;
|
|
- var normalizedRX = RSValues.x / this.gamepadAngularSensibility;
|
|
|
|
- var normalizedRY = RSValues.y / this.gamepadAngularSensibility;
|
|
|
|
- RSValues.x = Math.abs(normalizedRX) > 0.001 ? 0 + normalizedRX : 0;
|
|
|
|
- RSValues.y = Math.abs(normalizedRY) > 0.001 ? 0 + normalizedRY : 0;
|
|
|
|
|
|
+ if (RSValues) {
|
|
|
|
+ var normalizedRX = RSValues.x / this.gamepadAngularSensibility;
|
|
|
|
+ var normalizedRY = RSValues.y / this.gamepadAngularSensibility;
|
|
|
|
+ RSValues.x = Math.abs(normalizedRX) > 0.001 ? 0 + normalizedRX : 0;
|
|
|
|
+ RSValues.y = Math.abs(normalizedRY) > 0.001 ? 0 + normalizedRY : 0;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ RSValues = { x: 0, y: 0 };
|
|
|
|
+ }
|
|
if (!camera.rotationQuaternion) {
|
|
if (!camera.rotationQuaternion) {
|
|
BABYLON.Matrix.RotationYawPitchRollToRef(camera.rotation.y, camera.rotation.x, 0, this._cameraTransform);
|
|
BABYLON.Matrix.RotationYawPitchRollToRef(camera.rotation.y, camera.rotation.x, 0, this._cameraTransform);
|
|
}
|
|
}
|
|
@@ -45384,20 +45389,22 @@ var BABYLON;
|
|
if (this.gamepad) {
|
|
if (this.gamepad) {
|
|
var camera = this.camera;
|
|
var camera = this.camera;
|
|
var RSValues = this.gamepad.rightStick;
|
|
var RSValues = this.gamepad.rightStick;
|
|
- if (RSValues.x != 0) {
|
|
|
|
- var normalizedRX = RSValues.x / this.gamepadRotationSensibility;
|
|
|
|
- if (normalizedRX != 0 && Math.abs(normalizedRX) > 0.005) {
|
|
|
|
- camera.inertialAlphaOffset += normalizedRX;
|
|
|
|
|
|
+ if (RSValues) {
|
|
|
|
+ if (RSValues.x != 0) {
|
|
|
|
+ var normalizedRX = RSValues.x / this.gamepadRotationSensibility;
|
|
|
|
+ if (normalizedRX != 0 && Math.abs(normalizedRX) > 0.005) {
|
|
|
|
+ camera.inertialAlphaOffset += normalizedRX;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if (RSValues.y != 0) {
|
|
|
|
- var normalizedRY = RSValues.y / this.gamepadRotationSensibility;
|
|
|
|
- if (normalizedRY != 0 && Math.abs(normalizedRY) > 0.005) {
|
|
|
|
- camera.inertialBetaOffset += normalizedRY;
|
|
|
|
|
|
+ if (RSValues.y != 0) {
|
|
|
|
+ var normalizedRY = RSValues.y / this.gamepadRotationSensibility;
|
|
|
|
+ if (normalizedRY != 0 && Math.abs(normalizedRY) > 0.005) {
|
|
|
|
+ camera.inertialBetaOffset += normalizedRY;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var LSValues = this.gamepad.leftStick;
|
|
var LSValues = this.gamepad.leftStick;
|
|
- if (LSValues.y != 0) {
|
|
|
|
|
|
+ if (LSValues && LSValues.y != 0) {
|
|
var normalizedLY = LSValues.y / this.gamepadMoveSensibility;
|
|
var normalizedLY = LSValues.y / this.gamepadMoveSensibility;
|
|
if (normalizedLY != 0 && Math.abs(normalizedLY) > 0.005) {
|
|
if (normalizedLY != 0 && Math.abs(normalizedLY) > 0.005) {
|
|
this.camera.inertialRadiusOffset -= normalizedLY;
|
|
this.camera.inertialRadiusOffset -= normalizedLY;
|