From 7b95e26161eaf21fc7e21bfc4bdd1752192a5244 Mon Sep 17 00:00:00 2001 From: Christian Schiffler Date: Fri, 14 May 2021 14:00:51 +0200 Subject: [PATCH 1/4] Fix missing return values in examples --- examples/fsm/src/Girl.js | 2 ++ examples/fuzzy/src/Soldier.js | 4 ++++ examples/goal/src/Girl.js | 2 ++ examples/misc/savegame/src/CustomEntity.js | 2 ++ examples/misc/savegame/src/CustomVehicle.js | 2 +- examples/navigation/navmeshPerformance/src/CustomVehicle.js | 2 ++ examples/perception/memorySystem/src/CustomEntity.js | 4 ++++ examples/playground/hideAndSeek/src/Bullet.js | 2 ++ examples/playground/hideAndSeek/src/Enemy.js | 4 ++++ examples/playground/hideAndSeek/src/HideBehavior.js | 2 ++ examples/playground/hideAndSeek/src/Player.js | 2 +- examples/playground/shooter/src/Bullet.js | 2 ++ examples/playground/shooter/src/Target.js | 2 ++ 13 files changed, 30 insertions(+), 2 deletions(-) diff --git a/examples/fsm/src/Girl.js b/examples/fsm/src/Girl.js index ec391407..31aac11f 100644 --- a/examples/fsm/src/Girl.js +++ b/examples/fsm/src/Girl.js @@ -44,6 +44,8 @@ class Girl extends GameEntity { this.mixer.update( delta ); + return this; + } } diff --git a/examples/fuzzy/src/Soldier.js b/examples/fuzzy/src/Soldier.js index d3ca3ada..2e2d128d 100644 --- a/examples/fuzzy/src/Soldier.js +++ b/examples/fuzzy/src/Soldier.js @@ -43,6 +43,8 @@ class Soldier extends GameEntity { this.zombie = this.manager.getEntityByName( 'zombie' ); + return this; + } update() { @@ -53,6 +55,8 @@ class Soldier extends GameEntity { this.ui.currentWeapon.textContent = ( this.assaultRifle.visible ) ? 'Assault Rifle' : 'Shotgun'; + return this; + } selectWeapon() { diff --git a/examples/goal/src/Girl.js b/examples/goal/src/Girl.js index 7a7f79bf..5fa15fe3 100644 --- a/examples/goal/src/Girl.js +++ b/examples/goal/src/Girl.js @@ -65,6 +65,8 @@ class Girl extends Vehicle { this.mixer.update( delta ); + return this; + } tired() { diff --git a/examples/misc/savegame/src/CustomEntity.js b/examples/misc/savegame/src/CustomEntity.js index 74754a42..5ee7a6f2 100644 --- a/examples/misc/savegame/src/CustomEntity.js +++ b/examples/misc/savegame/src/CustomEntity.js @@ -26,6 +26,8 @@ class CustomEntity extends GameEntity { } + return super.update( delta ); + } generatePosition() { diff --git a/examples/misc/savegame/src/CustomVehicle.js b/examples/misc/savegame/src/CustomVehicle.js index e9a3425f..098f2787 100644 --- a/examples/misc/savegame/src/CustomVehicle.js +++ b/examples/misc/savegame/src/CustomVehicle.js @@ -20,7 +20,7 @@ class CustomVehicle extends Vehicle { const seekBehavior = this.steering.behaviors[ 0 ]; seekBehavior.target.copy( this.target.position ); - super.update( delta ); + return super.update( delta ); } diff --git a/examples/navigation/navmeshPerformance/src/CustomVehicle.js b/examples/navigation/navmeshPerformance/src/CustomVehicle.js index 607d7e74..6a8627a2 100644 --- a/examples/navigation/navmeshPerformance/src/CustomVehicle.js +++ b/examples/navigation/navmeshPerformance/src/CustomVehicle.js @@ -36,6 +36,8 @@ class CustomVehicle extends Vehicle { } + return this; + } diff --git a/examples/perception/memorySystem/src/CustomEntity.js b/examples/perception/memorySystem/src/CustomEntity.js index 673a57d7..8600263b 100644 --- a/examples/perception/memorySystem/src/CustomEntity.js +++ b/examples/perception/memorySystem/src/CustomEntity.js @@ -34,6 +34,8 @@ class CustomEntity extends GameEntity { this.target = target; this.vision.addObstacle( obstacle ); + return this; + } update( delta ) { @@ -88,6 +90,8 @@ class CustomEntity extends GameEntity { } + return this; + } updateVision() { diff --git a/examples/playground/hideAndSeek/src/Bullet.js b/examples/playground/hideAndSeek/src/Bullet.js index afa507cc..e591d2c9 100644 --- a/examples/playground/hideAndSeek/src/Bullet.js +++ b/examples/playground/hideAndSeek/src/Bullet.js @@ -83,6 +83,8 @@ class Bullet extends MovingEntity { } + return this; + } } diff --git a/examples/playground/hideAndSeek/src/Enemy.js b/examples/playground/hideAndSeek/src/Enemy.js index 5ba9a9b5..2f6d3aab 100644 --- a/examples/playground/hideAndSeek/src/Enemy.js +++ b/examples/playground/hideAndSeek/src/Enemy.js @@ -30,6 +30,8 @@ class Enemy extends Vehicle { const hideBehavior = new HideBehavior( this.manager, player ); this.steering.add( hideBehavior ); + return this; + } update( delta ) { @@ -73,6 +75,8 @@ class Enemy extends Vehicle { } + return this; + } handleMessage() { diff --git a/examples/playground/hideAndSeek/src/HideBehavior.js b/examples/playground/hideAndSeek/src/HideBehavior.js index 3834c2e6..dec40622 100644 --- a/examples/playground/hideAndSeek/src/HideBehavior.js +++ b/examples/playground/hideAndSeek/src/HideBehavior.js @@ -102,6 +102,8 @@ class HideBehavior extends SteeringBehavior { } + return force; + } _obstacleAvoidance( vehicle ) { diff --git a/examples/playground/hideAndSeek/src/Player.js b/examples/playground/hideAndSeek/src/Player.js index 1f30f05d..3a735de3 100644 --- a/examples/playground/hideAndSeek/src/Player.js +++ b/examples/playground/hideAndSeek/src/Player.js @@ -116,7 +116,7 @@ class Player extends MovingEntity { } - super.update( delta ); + return super.update( delta ); } diff --git a/examples/playground/shooter/src/Bullet.js b/examples/playground/shooter/src/Bullet.js index 2b38c1e0..80a71e66 100644 --- a/examples/playground/shooter/src/Bullet.js +++ b/examples/playground/shooter/src/Bullet.js @@ -83,6 +83,8 @@ class Bullet extends MovingEntity { } + return this; + } } diff --git a/examples/playground/shooter/src/Target.js b/examples/playground/shooter/src/Target.js index f4dcbac3..0ea9111e 100644 --- a/examples/playground/shooter/src/Target.js +++ b/examples/playground/shooter/src/Target.js @@ -30,6 +30,8 @@ class Target extends GameEntity { } + return this; + } handleMessage() { From d8978a70992cff2adaa27951626e87410909b54c Mon Sep 17 00:00:00 2001 From: Christian Schiffler Date: Fri, 14 May 2021 14:01:49 +0200 Subject: [PATCH 2/4] It is `lookingSpeed`, not `lookSpeed` --- examples/navigation/firstperson/index.html | 2 +- examples/playground/hideAndSeek/src/World.js | 2 +- examples/playground/shooter/src/World.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/navigation/firstperson/index.html b/examples/navigation/firstperson/index.html index 48f06d8b..a3b3dfef 100644 --- a/examples/navigation/firstperson/index.html +++ b/examples/navigation/firstperson/index.html @@ -165,7 +165,7 @@ player.position.set( - 13, - 0.75, - 9 ); controls = new FirstPersonControls( player ); - controls.lookSpeed = 2; + controls.lookingSpeed = 2; controls.setRotation( - 2.2, 0.2 ); controls.sounds.set( 'rightStep', step1 ); diff --git a/examples/playground/hideAndSeek/src/World.js b/examples/playground/hideAndSeek/src/World.js index 3cb62b39..f1926195 100644 --- a/examples/playground/hideAndSeek/src/World.js +++ b/examples/playground/hideAndSeek/src/World.js @@ -464,7 +464,7 @@ class World { const player = this.player; this.controls = new FirstPersonControls( player ); - this.controls.lookSpeed = 2; + this.controls.lookingSpeed = 2; const intro = this.ui.intro; const crosshairs = this.ui.crosshairs; diff --git a/examples/playground/shooter/src/World.js b/examples/playground/shooter/src/World.js index 30bc98d0..080d8086 100644 --- a/examples/playground/shooter/src/World.js +++ b/examples/playground/shooter/src/World.js @@ -301,7 +301,7 @@ class World { const player = this.player; this.controls = new FirstPersonControls( player ); - this.controls.lookSpeed = 2; + this.controls.lookingSpeed = 2; const intro = this.ui.intro; const crosshairs = this.ui.crosshairs; From f2788b74314a59de9027b85faad3107d1862ca44 Mon Sep 17 00:00:00 2001 From: Christian Schiffler Date: Fri, 14 May 2021 14:02:09 +0200 Subject: [PATCH 3/4] Remove unused assignment --- examples/playground/hideAndSeek/src/World.js | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/playground/hideAndSeek/src/World.js b/examples/playground/hideAndSeek/src/World.js index f1926195..22510a52 100644 --- a/examples/playground/hideAndSeek/src/World.js +++ b/examples/playground/hideAndSeek/src/World.js @@ -301,7 +301,6 @@ class World { if ( obstalce.geometry.intersectRay( ray, obstalce.worldMatrix, false, intersection.point, intersection.normal ) !== null ) { const squaredDistance = intersection.point.squaredDistanceTo( ray.origin ); - obstalce.squaredDistance = squaredDistance; if ( squaredDistance < minDistance ) { From a2c9f16e28e57406eb26528d9b28b8959cabeeb2 Mon Sep 17 00:00:00 2001 From: Christian Schiffler Date: Fri, 14 May 2021 14:02:31 +0200 Subject: [PATCH 4/4] Denote optional parameters as optional --- src/navigation/navmesh/NavMeshLoader.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/navigation/navmesh/NavMeshLoader.js b/src/navigation/navmesh/NavMeshLoader.js index 919bbe1b..acf8d4c7 100644 --- a/src/navigation/navmesh/NavMeshLoader.js +++ b/src/navigation/navmesh/NavMeshLoader.js @@ -17,7 +17,7 @@ class NavMeshLoader { * to influence the parsing of the navigation mesh. * * @param {String} url - The URL of the glTF asset. - * @param {Object} options - The (optional) configuration object. + * @param {Object} [options] - The (optional) configuration object. * @return {Promise} A promise representing the loading and parsing process. */ load( url, options ) { @@ -74,8 +74,8 @@ class NavMeshLoader { * in node.js. * * @param {ArrayBuffer} arrayBuffer - The array buffer. - * @param {String} url - The (optional) URL. - * @param {Object} options - The (optional) configuration object. + * @param {String} [url] - The (optional) URL. + * @param {Object} [options] - The (optional) configuration object. * @return {Promise} A promise representing the parsing process. */ parse( arrayBuffer, url, options ) {