playcanvas 2.10.4 → 2.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * PlayCanvas Engine v2.10.4 revision 7904b1a (PROFILE)
3
+ * PlayCanvas Engine v2.10.5 revision 8959e32 (PROFILE)
4
4
  * Copyright 2011-2025 PlayCanvas Ltd. All rights reserved.
5
5
  *
6
6
  * This source code is licensed under the MIT license found in the
@@ -296,8 +296,8 @@
296
296
  "@swc/helpers - typeof";
297
297
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
298
298
  }
299
- var version = '2.10.4';
300
- var revision = '7904b1a';
299
+ var version = '2.10.5';
300
+ var revision = '8959e32';
301
301
  function extend(target, ex) {
302
302
  for(var prop in ex){
303
303
  var copy = ex[prop];
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * PlayCanvas Engine v2.10.4 revision 7904b1a (PROFILE)
3
+ * PlayCanvas Engine v2.10.5 revision 8959e32 (PROFILE)
4
4
  * Copyright 2011-2025 PlayCanvas Ltd. All rights reserved.
5
5
  *
6
6
  * This source code is licensed under the MIT license found in the
@@ -29,8 +29,8 @@ const TRACEID_TEXTURES = 'Textures';
29
29
  const TRACEID_RENDER_QUEUE = 'RenderQueue';
30
30
  const TRACEID_GPU_TIMINGS = 'GpuTimings';
31
31
 
32
- const version = '2.10.4';
33
- const revision = '7904b1a';
32
+ const version = '2.10.5';
33
+ const revision = '8959e32';
34
34
  function extend(target, ex) {
35
35
  for(const prop in ex){
36
36
  const copy = ex[prop];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playcanvas",
3
- "version": "2.10.4",
3
+ "version": "2.10.5",
4
4
  "author": "PlayCanvas <support@playcanvas.com>",
5
5
  "homepage": "https://playcanvas.com",
6
6
  "description": "PlayCanvas WebGL game engine",
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  math,
3
- CameraComponent,
4
3
  InputFrame,
5
4
  KeyboardMouseSource,
6
5
  DualGestureSource,
@@ -67,11 +66,10 @@ class FirstPersonController extends Script {
67
66
  static scriptName = 'firstPersonController';
68
67
 
69
68
  /**
70
- * @type {CameraComponent}
69
+ * @type {boolean}
71
70
  * @private
72
71
  */
73
- // @ts-ignore
74
- _camera;
72
+ _ready = false;
75
73
 
76
74
  /**
77
75
  * @type {RigidBodyComponent}
@@ -171,6 +169,15 @@ class FirstPersonController extends Script {
171
169
  */
172
170
  _gamePadTurnSpeed = 30;
173
171
 
172
+ /**
173
+ * @attribute
174
+ * @title Camera
175
+ * @description The camera entity that will be used for looking around.
176
+ * @type {Entity}
177
+ */
178
+ // @ts-ignore
179
+ camera;
180
+
174
181
  /**
175
182
  * @attribute
176
183
  * @title Look Sensitivity
@@ -238,9 +245,8 @@ class FirstPersonController extends Script {
238
245
  joystickEventName = 'joystick';
239
246
 
240
247
  initialize() {
241
- // check camera
242
- if (!this._camera) {
243
- throw new Error('FirstPersonController requires a camera component');
248
+ if (!this.camera) {
249
+ throw new Error('FirstPersonController: Camera entity is required.');
244
250
  }
245
251
 
246
252
  // check collision and rigidbody
@@ -279,22 +285,8 @@ class FirstPersonController extends Script {
279
285
  });
280
286
 
281
287
  this.on('destroy', this.destroy, this);
282
- }
283
288
 
284
- /**
285
- * @attribute
286
- * @title Camera
287
- * @description The camera entity that will be used for looking around.
288
- * @type {Entity}
289
- */
290
- set camera(entity) {
291
- if (entity.camera instanceof CameraComponent) {
292
- this._camera = entity.camera;
293
- }
294
- }
295
-
296
- get camera() {
297
- return this._camera;
289
+ this._ready = true;
298
290
  }
299
291
 
300
292
  /**
@@ -303,6 +295,7 @@ class FirstPersonController extends Script {
303
295
  * @description Radial thickness of inner dead zone of the virtual joysticks. This dead zone ensures the virtual joysticks report a value of 0 even if a touch deviates a small amount from the initial touch.
304
296
  * @type {number}
305
297
  * @range [0, 0.4]
298
+ * @default 0.3
306
299
  */
307
300
  set mobileDeadZone(value) {
308
301
  this._mobileDeadZone = value ?? this._mobileDeadZone;
@@ -317,6 +310,7 @@ class FirstPersonController extends Script {
317
310
  * @title Mobile Turn Speed
318
311
  * @description Maximum turn speed in degrees per second
319
312
  * @type {number}
313
+ * @default 30
320
314
  */
321
315
  set mobileTurnSpeed(value) {
322
316
  this._mobileTurnSpeed = value ?? this._mobileTurnSpeed;
@@ -331,6 +325,7 @@ class FirstPersonController extends Script {
331
325
  * @title Mobile Radius
332
326
  * @description The radius of the virtual joystick in CSS pixels.
333
327
  * @type {number}
328
+ * @default 50
334
329
  */
335
330
  set mobileRadius(value) {
336
331
  this._mobileRadius = value ?? this._mobileRadius;
@@ -345,6 +340,7 @@ class FirstPersonController extends Script {
345
340
  * @title Mobile Double Tap Interval
346
341
  * @description The time in milliseconds between two taps of the right virtual joystick for a double tap to register. A double tap will trigger a cc:jump.
347
342
  * @type {number}
343
+ * @default 300
348
344
  */
349
345
  set mobileDoubleTapInterval(value) {
350
346
  this._mobileDoubleTapInterval = value ?? this._mobileDoubleTapInterval;
@@ -360,6 +356,7 @@ class FirstPersonController extends Script {
360
356
  * @description Radial thickness of inner dead zone of pad's joysticks. This dead zone ensures that all pads report a value of 0 for each joystick axis when untouched.
361
357
  * @type {number}
362
358
  * @range [0, 0.4]
359
+ * @default 0.1
363
360
  */
364
361
  set gamePadDeadZoneLow(value) {
365
362
  this._gamePadDeadZoneLow = value ?? this._gamePadDeadZoneLow;
@@ -375,6 +372,7 @@ class FirstPersonController extends Script {
375
372
  * @description Radial thickness of outer dead zone of pad's joysticks. This dead zone ensures that all pads can reach the -1 and 1 limits of each joystick axis.
376
373
  * @type {number}
377
374
  * @range [0, 0.4]
375
+ * @default 0.1
378
376
  */
379
377
  set gamePadDeadZoneHigh(value) {
380
378
  this._gamePadDeadZoneHigh = value ?? this._gamePadDeadZoneHigh;
@@ -389,6 +387,7 @@ class FirstPersonController extends Script {
389
387
  * @title GamePad Turn Speed
390
388
  * @description Maximum turn speed in degrees per second
391
389
  * @type {number}
390
+ * @default 30
392
391
  */
393
392
  set gamePadTurnSpeed(value) {
394
393
  this._gamePadTurnSpeed = value ?? this._gamePadTurnSpeed;
@@ -418,7 +417,7 @@ class FirstPersonController extends Script {
418
417
  // rotate
419
418
  this._angles.add(v.set(-rotate[1], -rotate[0], 0));
420
419
  this._angles.x = math.clamp(this._angles.x, -90, 90);
421
- this.camera.entity.setLocalEulerAngles(this._angles);
420
+ this.camera.setLocalEulerAngles(this._angles);
422
421
 
423
422
  // move
424
423
  rotation.setFromEulerAngles(0, this._angles.y, 0);
@@ -438,6 +437,10 @@ class FirstPersonController extends Script {
438
437
  * @param {number} dt - The delta time.
439
438
  */
440
439
  update(dt) {
440
+ if (!this._ready) {
441
+ return;
442
+ }
443
+
441
444
  const { keyCode } = KeyboardMouseSource;
442
445
  const { buttonCode } = GamepadSource;
443
446