Skip to content

Commit efece3d

Browse files
committed
Camera controls fixes (#7889)
1 parent 441fc1f commit efece3d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

scripts/esm/camera-controls.mjs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class CameraControls extends Script {
158158
* @type {Vec2}
159159
* @private
160160
*/
161-
_zoomRange = new Vec2();
161+
_zoomRange = new Vec2(0.01, 0);
162162

163163
/**
164164
* @type {KeyboardMouseSource}
@@ -343,7 +343,8 @@ class CameraControls extends Script {
343343
*/
344344
joystickEventName = 'joystick';
345345

346-
initialize() {
346+
constructor({ app, entity, ...args }) {
347+
super({ app, entity, ...args });
347348
if (!this.entity.camera) {
348349
console.error('CameraControls: camera component not found');
349350
return;
@@ -389,6 +390,7 @@ class CameraControls extends Script {
389390
* @attribute
390391
* @title Enable Orbit
391392
* @type {boolean}
393+
* @default true
392394
*/
393395
set enableOrbit(enable) {
394396
this._enableOrbit = enable;
@@ -408,6 +410,7 @@ class CameraControls extends Script {
408410
* @attribute
409411
* @title Enable Fly
410412
* @type {boolean}
413+
* @default true
411414
*/
412415
set enableFly(enable) {
413416
this._enableFly = enable;
@@ -427,6 +430,7 @@ class CameraControls extends Script {
427430
* @attribute
428431
* @title Focus Point
429432
* @type {Vec3}
433+
* @default [0, 0, 0]
430434
*/
431435
set focusPoint(point) {
432436
const position = this._camera.entity.getPosition();
@@ -445,6 +449,7 @@ class CameraControls extends Script {
445449
* @attribute
446450
* @title Rotate Damping
447451
* @type {number}
452+
* @default 0.98
448453
*/
449454
set focusDamping(damping) {
450455
this._focusController.focusDamping = damping;
@@ -461,6 +466,7 @@ class CameraControls extends Script {
461466
* @attribute
462467
* @title Rotate Damping
463468
* @type {number}
469+
* @default 0.98
464470
*/
465471
set rotateDamping(damping) {
466472
this._flyController.rotateDamping = damping;
@@ -478,6 +484,7 @@ class CameraControls extends Script {
478484
* @attribute
479485
* @title Move Damping
480486
* @type {number}
487+
* @default 0.98
481488
*/
482489
set moveDamping(damping) {
483490
this._flyController.moveDamping = damping;
@@ -494,6 +501,7 @@ class CameraControls extends Script {
494501
* @attribute
495502
* @title Zoom Damping
496503
* @type {number}
504+
* @default 0.98
497505
*/
498506
set zoomDamping(damping) {
499507
this._orbitController.zoomDamping = damping;
@@ -510,6 +518,7 @@ class CameraControls extends Script {
510518
* @attribute
511519
* @title Pitch Range
512520
* @type {Vec2}
521+
* @default [-360, 360]
513522
*/
514523
set pitchRange(range) {
515524
this._pitchRange.x = math.clamp(range.x, -360, 360);
@@ -529,6 +538,7 @@ class CameraControls extends Script {
529538
* @attribute
530539
* @title Yaw Range
531540
* @type {Vec2}
541+
* @default [-360, 360]
532542
*/
533543
set yawRange(range) {
534544
this._yawRange.x = math.clamp(range.x, -360, 360);
@@ -547,6 +557,7 @@ class CameraControls extends Script {
547557
* @attribute
548558
* @title Zoom Range
549559
* @type {Vec2}
560+
* @default [0.01, 0]
550561
*/
551562
set zoomRange(range) {
552563
this._zoomRange.x = range.x;
@@ -571,6 +582,7 @@ class CameraControls extends Script {
571582
* @attribute
572583
* @title Use Virtual Gamepad
573584
* @type {string}
585+
* @default 'joystick-touch'
574586
*/
575587
set mobileInputLayout(layout) {
576588
if (!/(?:joystick|touch)-(?:joystick|touch)/.test(layout)) {

0 commit comments

Comments
 (0)