gdcore-tools 2.0.0-gd-v5.4.219-autobuild → 2.0.0-gd-v5.5.221-autobuild

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.
Files changed (33) hide show
  1. package/dist/Runtime/Extensions/DialogueTree/bondage.js/dist/bondage.d.ts +39 -0
  2. package/dist/Runtime/Extensions/DialogueTree/dialoguetools.js +2 -2
  3. package/dist/Runtime/Extensions/DialogueTree/dialoguetools.js.map +2 -2
  4. package/dist/Runtime/Extensions/Physics2Behavior/JsExtension.js +23 -21
  5. package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js.map +1 -1
  6. package/dist/Runtime/Extensions/Physics2Behavior/physics2tools.js +1 -1
  7. package/dist/Runtime/Extensions/Physics2Behavior/physics2tools.js.map +2 -2
  8. package/dist/Runtime/Extensions/Physics3DBehavior/JsExtension.js +2472 -0
  9. package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js +2 -0
  10. package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js.map +7 -0
  11. package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DTools.js +2 -0
  12. package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DTools.js.map +7 -0
  13. package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js +2 -0
  14. package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js.map +7 -0
  15. package/dist/Runtime/Extensions/Physics3DBehavior/jolt-physics.d.ts +5152 -0
  16. package/dist/Runtime/Extensions/Physics3DBehavior/jolt-physics.wasm.js +2 -0
  17. package/dist/Runtime/Extensions/Physics3DBehavior/jolt-physics.wasm.js.map +7 -0
  18. package/dist/Runtime/Extensions/Physics3DBehavior/jolt-physics.wasm.wasm +0 -0
  19. package/dist/Runtime/Extensions/PlatformBehavior/platformerobjectruntimebehavior.js.map +2 -2
  20. package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.js +1 -1
  21. package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.js.map +1 -1
  22. package/dist/Runtime/RuntimeInstanceContainer.js +1 -1
  23. package/dist/Runtime/RuntimeInstanceContainer.js.map +2 -2
  24. package/dist/Runtime/events-tools/soundtools.js +1 -1
  25. package/dist/Runtime/events-tools/soundtools.js.map +2 -2
  26. package/dist/Runtime/pixi-renderers/pixi-image-manager.js +1 -1
  27. package/dist/Runtime/pixi-renderers/pixi-image-manager.js.map +2 -2
  28. package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js +1 -1
  29. package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js.map +2 -2
  30. package/dist/lib/libGD.cjs +1 -1
  31. package/dist/lib/libGD.wasm +0 -0
  32. package/gd.d.ts +4 -2
  33. package/package.json +1 -1
@@ -0,0 +1,2472 @@
1
+ //@ts-check
2
+ /// <reference path="../JsExtensionTypes.d.ts" />
3
+ /**
4
+ * This is a declaration of an extension for GDevelop 5.
5
+ *
6
+ * ℹ️ Changes in this file are watched and automatically imported if the editor
7
+ * is running. You can also manually run `node import-GDJS-Runtime.js` (in newIDE/app/scripts).
8
+ *
9
+ * The file must be named "JsExtension.js", otherwise GDevelop won't load it.
10
+ * ⚠️ If you make a change and the extension is not loaded, open the developer console
11
+ * and search for any errors.
12
+ *
13
+ * More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
14
+ */
15
+
16
+ /** @type {ExtensionModule} */
17
+ module.exports = {
18
+ createExtension: function (_, gd) {
19
+ const extension = new gd.PlatformExtension();
20
+ extension
21
+ .setExtensionInformation(
22
+ 'Physics3D',
23
+ _('3D Physics Engine'),
24
+ "The physics engine simulates realistic object physics, with gravity, forces, joints, etc. It's perfect for games that need to have realistic behaving objects and a gameplay centered around it.",
25
+ 'Florian Rival',
26
+ 'MIT'
27
+ )
28
+ .setExtensionHelpPath('/behaviors/physics3d')
29
+ .setCategory('Movement')
30
+ .setTags('physics, gravity, obstacle, collision');
31
+ extension
32
+ .addInstructionOrExpressionGroupMetadata(_('3D Physics Engine'))
33
+ .setIcon('JsPlatform/Extensions/physics3d.svg');
34
+ {
35
+ const behavior = new gd.BehaviorJsImplementation();
36
+ behavior.updateProperty = function (
37
+ behaviorContent,
38
+ propertyName,
39
+ newValue
40
+ ) {
41
+ if (propertyName === 'object3D') {
42
+ behaviorContent.getChild('object3D').setStringValue(newValue);
43
+ return true;
44
+ }
45
+
46
+ if (propertyName === 'bodyType') {
47
+ behaviorContent.getChild('bodyType').setStringValue(newValue);
48
+ return true;
49
+ }
50
+
51
+ if (propertyName === 'bullet') {
52
+ behaviorContent.getChild('bullet').setBoolValue(newValue === '1');
53
+ return true;
54
+ }
55
+
56
+ if (propertyName === 'fixedRotation') {
57
+ behaviorContent
58
+ .getChild('fixedRotation')
59
+ .setBoolValue(newValue === '1');
60
+ return true;
61
+ }
62
+
63
+ if (propertyName === 'shape') {
64
+ behaviorContent.getChild('shape').setStringValue(newValue);
65
+ return true;
66
+ }
67
+
68
+ if (propertyName === 'shapeOrientation') {
69
+ behaviorContent.getChild('shapeOrientation').setStringValue(newValue);
70
+ return true;
71
+ }
72
+
73
+ if (propertyName === 'shapeDimensionA') {
74
+ const newValueAsNumber = parseFloat(newValue);
75
+ if (newValueAsNumber !== newValueAsNumber) return false;
76
+ behaviorContent
77
+ .getChild('shapeDimensionA')
78
+ .setDoubleValue(newValueAsNumber);
79
+ return true;
80
+ }
81
+
82
+ if (propertyName === 'shapeDimensionB') {
83
+ const newValueAsNumber = parseFloat(newValue);
84
+ if (newValueAsNumber !== newValueAsNumber) return false;
85
+ behaviorContent
86
+ .getChild('shapeDimensionB')
87
+ .setDoubleValue(newValueAsNumber);
88
+ return true;
89
+ }
90
+
91
+ if (propertyName === 'shapeDimensionC') {
92
+ const newValueAsNumber = parseFloat(newValue);
93
+ if (newValueAsNumber !== newValueAsNumber) return false;
94
+ behaviorContent
95
+ .getChild('shapeDimensionC')
96
+ .setDoubleValue(newValueAsNumber);
97
+ return true;
98
+ }
99
+
100
+ if (propertyName === 'density') {
101
+ behaviorContent
102
+ .getChild('density')
103
+ .setDoubleValue(parseFloat(newValue));
104
+ return true;
105
+ }
106
+
107
+ if (propertyName === 'friction') {
108
+ const newValueAsNumber = parseFloat(newValue);
109
+ if (newValueAsNumber !== newValueAsNumber) return false;
110
+ behaviorContent.getChild('friction').setDoubleValue(newValueAsNumber);
111
+ return true;
112
+ }
113
+
114
+ if (propertyName === 'restitution') {
115
+ const newValueAsNumber = parseFloat(newValue);
116
+ if (newValueAsNumber !== newValueAsNumber) return false;
117
+ behaviorContent
118
+ .getChild('restitution')
119
+ .setDoubleValue(newValueAsNumber);
120
+ return true;
121
+ }
122
+
123
+ if (propertyName === 'linearDamping') {
124
+ const newValueAsNumber = Math.max(0, parseFloat(newValue));
125
+ if (newValueAsNumber !== newValueAsNumber) return false;
126
+ behaviorContent
127
+ .getChild('linearDamping')
128
+ .setDoubleValue(newValueAsNumber);
129
+ return true;
130
+ }
131
+
132
+ if (propertyName === 'angularDamping') {
133
+ const newValueAsNumber = Math.max(0, parseFloat(newValue));
134
+ if (newValueAsNumber !== newValueAsNumber) return false;
135
+ behaviorContent
136
+ .getChild('angularDamping')
137
+ .setDoubleValue(newValueAsNumber);
138
+ return true;
139
+ }
140
+
141
+ if (propertyName === 'gravityScale') {
142
+ const newValueAsNumber = parseFloat(newValue);
143
+ if (newValueAsNumber !== newValueAsNumber) return false;
144
+ behaviorContent
145
+ .getChild('gravityScale')
146
+ .setDoubleValue(newValueAsNumber);
147
+ return true;
148
+ }
149
+
150
+ if (propertyName === 'layers') {
151
+ behaviorContent
152
+ .getChild('layers')
153
+ .setIntValue(parseInt(newValue, 10));
154
+ return true;
155
+ }
156
+
157
+ if (propertyName === 'masks') {
158
+ behaviorContent.getChild('masks').setIntValue(parseInt(newValue, 10));
159
+ return true;
160
+ }
161
+
162
+ return false;
163
+ };
164
+ behavior.getProperties = function (behaviorContent) {
165
+ const behaviorProperties = new gd.MapStringPropertyDescriptor();
166
+
167
+ behaviorProperties
168
+ .getOrCreate('object3D')
169
+ .setValue(behaviorContent.getChild('Object3D').getStringValue())
170
+ .setType('Behavior')
171
+ .setLabel('3D capability')
172
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden)
173
+ .addExtraInfo('Scene3D::Base3DBehavior');
174
+
175
+ behaviorProperties
176
+ .getOrCreate('bodyType')
177
+ .setValue(behaviorContent.getChild('bodyType').getStringValue())
178
+ .setType('Choice')
179
+ .setLabel('Type')
180
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden)
181
+ .addExtraInfo('Static')
182
+ .addExtraInfo('Dynamic')
183
+ .addExtraInfo('Kinematic')
184
+ .setDescription(
185
+ _(
186
+ "A static object won't move (perfect for obstacles). Dynamic objects can move. Kinematic will move according to forces applied to it only (useful for characters or specific mechanisms)."
187
+ )
188
+ );
189
+ behaviorProperties
190
+ .getOrCreate('bullet')
191
+ .setValue(
192
+ behaviorContent.getChild('bullet').getBoolValue() ? 'true' : 'false'
193
+ )
194
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden)
195
+ .setType('Boolean')
196
+ .setLabel(_('Considered as a bullet'))
197
+ .setDescription(
198
+ _(
199
+ 'Useful for fast moving objects which requires a more accurate collision detection.'
200
+ )
201
+ )
202
+ .setGroup(_('Physics body advanced settings'))
203
+ .setAdvanced(true);
204
+ behaviorProperties
205
+ .getOrCreate('fixedRotation')
206
+ .setValue(
207
+ behaviorContent.getChild('fixedRotation').getBoolValue()
208
+ ? 'true'
209
+ : 'false'
210
+ )
211
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden)
212
+ .setType('Boolean')
213
+ .setLabel('Fixed Rotation')
214
+ .setDescription(
215
+ _(
216
+ "If enabled, the object won't rotate and will stay at the same angle. Useful for characters for example."
217
+ )
218
+ )
219
+ .setGroup(_('Movement'));
220
+ behaviorProperties
221
+ .getOrCreate('shape')
222
+ .setValue(behaviorContent.getChild('shape').getStringValue())
223
+ .setType('Choice')
224
+ .setLabel('Shape')
225
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden)
226
+ .addExtraInfo('Box')
227
+ .addExtraInfo('Capsule')
228
+ .addExtraInfo('Cylinder')
229
+ .addExtraInfo('Sphere');
230
+ behaviorProperties
231
+ .getOrCreate('shapeOrientation')
232
+ .setValue(
233
+ behaviorContent.getChild('shapeOrientation').getStringValue()
234
+ )
235
+ .setType('Choice')
236
+ .setLabel('Shape orientation')
237
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden)
238
+ .addExtraInfo('Z')
239
+ .addExtraInfo('Y')
240
+ .addExtraInfo('X');
241
+ behaviorProperties
242
+ .getOrCreate('shapeDimensionA')
243
+ .setValue(
244
+ behaviorContent
245
+ .getChild('shapeDimensionA')
246
+ .getDoubleValue()
247
+ .toString(10)
248
+ )
249
+ .setType('Number')
250
+ .setMeasurementUnit(gd.MeasurementUnit.getPixel())
251
+ .setLabel('Shape Dimension A')
252
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden)
253
+ .setHidden(true); // Hidden as required to be changed in the full editor.
254
+ behaviorProperties
255
+ .getOrCreate('shapeDimensionB')
256
+ .setValue(
257
+ behaviorContent
258
+ .getChild('shapeDimensionB')
259
+ .getDoubleValue()
260
+ .toString(10)
261
+ )
262
+ .setType('Number')
263
+ .setMeasurementUnit(gd.MeasurementUnit.getPixel())
264
+ .setLabel('Shape Dimension B')
265
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden)
266
+ .setHidden(true); // Hidden as required to be changed in the full editor.
267
+ behaviorProperties
268
+ .getOrCreate('shapeDimensionC')
269
+ .setValue(
270
+ behaviorContent
271
+ .getChild('shapeDimensionC')
272
+ .getDoubleValue()
273
+ .toString(10)
274
+ )
275
+ .setType('Number')
276
+ .setMeasurementUnit(gd.MeasurementUnit.getPixel())
277
+ .setLabel('Shape Dimension C')
278
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden)
279
+ .setHidden(true); // Hidden as required to be changed in the full editor.
280
+ behaviorProperties
281
+ .getOrCreate('density')
282
+ .setValue(
283
+ behaviorContent.getChild('density').getDoubleValue().toString(10)
284
+ )
285
+ .setType('Number')
286
+ .setLabel(_('Density'))
287
+ .setDescription(
288
+ _(
289
+ 'Define the weight of the object, according to its size. The bigger the density, the heavier the object.'
290
+ )
291
+ );
292
+ behaviorProperties
293
+ .getOrCreate('friction')
294
+ .setValue(
295
+ behaviorContent.getChild('friction').getDoubleValue().toString(10)
296
+ )
297
+ .setType('Number')
298
+ .setLabel(_('Friction'))
299
+ .setDescription(
300
+ _(
301
+ 'The friction applied when touching other objects. The higher the value, the more friction.'
302
+ )
303
+ )
304
+ .setGroup(_('Movement'));
305
+ behaviorProperties
306
+ .getOrCreate('restitution')
307
+ .setValue(
308
+ behaviorContent
309
+ .getChild('restitution')
310
+ .getDoubleValue()
311
+ .toString(10)
312
+ )
313
+ .setType('Number')
314
+ .setLabel(_('Restitution'))
315
+ .setDescription(
316
+ _(
317
+ 'The "bounciness" of the object. The higher the value, the more other objects will bounce against it.'
318
+ )
319
+ )
320
+ .setGroup(_('Movement'));
321
+ behaviorProperties
322
+ .getOrCreate('linearDamping')
323
+ .setValue(
324
+ behaviorContent
325
+ .getChild('linearDamping')
326
+ .getDoubleValue()
327
+ .toString(10)
328
+ )
329
+ .setType('Number')
330
+ .setLabel(_('Linear Damping'))
331
+ .setGroup(_('Movement'));
332
+
333
+ behaviorProperties
334
+ .getOrCreate('angularDamping')
335
+ .setValue(
336
+ behaviorContent
337
+ .getChild('angularDamping')
338
+ .getDoubleValue()
339
+ .toString(10)
340
+ )
341
+ .setType('Number')
342
+ .setLabel(_('Angular Damping'))
343
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden)
344
+ .setGroup(_('Movement'));
345
+ behaviorProperties
346
+ .getOrCreate('gravityScale')
347
+ .setValue(
348
+ behaviorContent
349
+ .getChild('gravityScale')
350
+ .getDoubleValue()
351
+ .toString(10)
352
+ )
353
+ .setType('Number')
354
+ .setLabel('Gravity Scale')
355
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden)
356
+ .setGroup(_('Gravity'))
357
+ .setAdvanced(true);
358
+ behaviorProperties
359
+ .getOrCreate('layers')
360
+ .setValue(
361
+ behaviorContent.getChild('layers').getIntValue().toString(10)
362
+ )
363
+ .setType('Number')
364
+ .setLabel('Layers')
365
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden)
366
+ .setHidden(true); // Hidden as required to be changed in the full editor.
367
+ behaviorProperties
368
+ .getOrCreate('masks')
369
+ .setValue(
370
+ behaviorContent.getChild('masks').getIntValue().toString(10)
371
+ )
372
+ .setType('Number')
373
+ .setLabel('Masks')
374
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden)
375
+ .setHidden(true); // Hidden as required to be changed in the full editor.
376
+
377
+ return behaviorProperties;
378
+ };
379
+
380
+ behavior.initializeContent = function (behaviorContent) {
381
+ behaviorContent.addChild('object3D').setStringValue('');
382
+ behaviorContent.addChild('bodyType').setStringValue('Dynamic');
383
+ behaviorContent.addChild('bullet').setBoolValue(false);
384
+ behaviorContent.addChild('fixedRotation').setBoolValue(false);
385
+ behaviorContent.addChild('shape').setStringValue('Box');
386
+ behaviorContent.addChild('shapeOrientation').setStringValue('Z');
387
+ behaviorContent.addChild('shapeDimensionA').setDoubleValue(0);
388
+ behaviorContent.addChild('shapeDimensionB').setDoubleValue(0);
389
+ behaviorContent.addChild('shapeDimensionC').setDoubleValue(0);
390
+ behaviorContent.addChild('density').setDoubleValue(1.0);
391
+ behaviorContent.addChild('friction').setDoubleValue(0.3);
392
+ behaviorContent.addChild('restitution').setDoubleValue(0.1);
393
+ behaviorContent.addChild('linearDamping').setDoubleValue(0.1);
394
+ behaviorContent.addChild('angularDamping').setDoubleValue(0.1);
395
+ behaviorContent.addChild('gravityScale').setDoubleValue(1);
396
+ behaviorContent.addChild('layers').setIntValue((1 << 4) | (1 << 0));
397
+ behaviorContent.addChild('masks').setIntValue((1 << 4) | (1 << 0));
398
+ };
399
+
400
+ const sharedData = new gd.BehaviorSharedDataJsImplementation();
401
+ sharedData.updateProperty = function (
402
+ sharedContent,
403
+ propertyName,
404
+ newValue
405
+ ) {
406
+ if (propertyName === 'gravityX') {
407
+ const newValueAsNumber = parseFloat(newValue);
408
+ if (newValueAsNumber !== newValueAsNumber) return false;
409
+ sharedContent.getChild('gravityX').setDoubleValue(newValueAsNumber);
410
+ return true;
411
+ }
412
+
413
+ if (propertyName === 'gravityY') {
414
+ const newValueAsNumber = parseFloat(newValue);
415
+ if (newValueAsNumber !== newValueAsNumber) return false;
416
+ sharedContent.getChild('gravityY').setDoubleValue(newValueAsNumber);
417
+ return true;
418
+ }
419
+
420
+ if (propertyName === 'gravityZ') {
421
+ const newValueAsNumber = parseFloat(newValue);
422
+ if (newValueAsNumber !== newValueAsNumber) return false;
423
+ sharedContent.getChild('gravityZ').setDoubleValue(newValueAsNumber);
424
+ return true;
425
+ }
426
+
427
+ if (propertyName === 'worldScale') {
428
+ const newValueAsNumber = parseInt(newValue, 10);
429
+ if (newValueAsNumber !== newValueAsNumber) return false;
430
+ if (!sharedContent.hasChild('worldScale')) {
431
+ sharedContent.addChild('worldScale');
432
+ }
433
+ sharedContent.getChild('worldScale').setDoubleValue(newValueAsNumber);
434
+ return true;
435
+ }
436
+ return false;
437
+ };
438
+ sharedData.getProperties = function (sharedContent) {
439
+ const sharedProperties = new gd.MapStringPropertyDescriptor();
440
+
441
+ sharedProperties
442
+ .getOrCreate('gravityX')
443
+ .setValue(
444
+ sharedContent.getChild('gravityX').getDoubleValue().toString(10)
445
+ )
446
+ .setType('Number')
447
+ .setMeasurementUnit(gd.MeasurementUnit.getNewton());
448
+ sharedProperties
449
+ .getOrCreate('gravityY')
450
+ .setValue(
451
+ sharedContent.getChild('gravityY').getDoubleValue().toString(10)
452
+ )
453
+ .setType('Number')
454
+ .setMeasurementUnit(gd.MeasurementUnit.getNewton());
455
+ sharedProperties
456
+ .getOrCreate('gravityZ')
457
+ .setValue(
458
+ sharedContent.getChild('gravityZ').getDoubleValue().toString(10)
459
+ )
460
+ .setType('Number')
461
+ .setMeasurementUnit(gd.MeasurementUnit.getNewton());
462
+
463
+ sharedProperties
464
+ .getOrCreate('worldScale')
465
+ .setValue(
466
+ sharedContent.getChild('worldScale').getDoubleValue().toString(10)
467
+ )
468
+ .setType('Number');
469
+
470
+ return sharedProperties;
471
+ };
472
+ sharedData.initializeContent = function (behaviorContent) {
473
+ behaviorContent.addChild('gravityX').setDoubleValue(0);
474
+ behaviorContent.addChild('gravityY').setDoubleValue(0);
475
+ behaviorContent.addChild('gravityZ').setDoubleValue(-9.8);
476
+ behaviorContent.addChild('worldScale').setDoubleValue(100);
477
+ };
478
+
479
+ const aut = extension
480
+ .addBehavior(
481
+ 'Physics3DBehavior',
482
+ _('3D physics engine'),
483
+ 'Physics3D',
484
+ _('Simulate realistic object physics with gravity, forces, etc.'),
485
+ '',
486
+ 'JsPlatform/Extensions/physics3d.svg',
487
+ 'Physics3DBehavior',
488
+ //@ts-ignore The class hierarchy is incorrect leading to a type error, but this is valid.
489
+ behavior,
490
+ sharedData
491
+ )
492
+ .addIncludeFile(
493
+ 'Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js'
494
+ )
495
+ .addRequiredFile('Extensions/Physics3DBehavior/jolt-physics.wasm.js')
496
+ .addRequiredFile('Extensions/Physics3DBehavior/jolt-physics.wasm.wasm')
497
+ .setOpenFullEditorLabel(_('Edit shape and advanced settings'));
498
+
499
+ // Global
500
+ aut
501
+ .addExpression(
502
+ 'WorldScale',
503
+ _('World scale'),
504
+ _('Return the world scale.'),
505
+ _('Global'),
506
+ 'JsPlatform/Extensions/physics3d.svg'
507
+ )
508
+ .addParameter('object', _('Object'), '', false)
509
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
510
+ .getCodeExtraInformation()
511
+ .setFunctionName('getWorldScale');
512
+
513
+ aut
514
+ .addExpressionAndConditionAndAction(
515
+ 'number',
516
+ 'GravityX',
517
+ _('World gravity on X axis'),
518
+ _('the world gravity on X axis') +
519
+ ' ' +
520
+ _(
521
+ 'While an object is needed, this will apply to all objects using the behavior.'
522
+ ),
523
+ _('the world gravity on X axis'),
524
+ _('Global'),
525
+ 'JsPlatform/Extensions/physics3d.svg'
526
+ )
527
+ .addParameter('object', _('Object'), '', false)
528
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
529
+ .useStandardParameters(
530
+ 'number',
531
+ gd.ParameterOptions.makeNewOptions().setDescription(
532
+ _('Gravity (in Newton)')
533
+ )
534
+ )
535
+ .setFunctionName('setGravityX')
536
+ .setGetter('getGravityX');
537
+
538
+ aut
539
+ .addExpressionAndConditionAndAction(
540
+ 'number',
541
+ 'GravityY',
542
+ _('World gravity on Y axis'),
543
+ _('the world gravity on Y axis') +
544
+ ' ' +
545
+ _(
546
+ 'While an object is needed, this will apply to all objects using the behavior.'
547
+ ),
548
+ _('the world gravity on Y axis'),
549
+ _('Global'),
550
+ 'JsPlatform/Extensions/physics3d.svg'
551
+ )
552
+ .addParameter('object', _('Object'), '', false)
553
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
554
+ .useStandardParameters(
555
+ 'number',
556
+ gd.ParameterOptions.makeNewOptions().setDescription(
557
+ _('Gravity (in Newton)')
558
+ )
559
+ )
560
+ .setFunctionName('setGravityY')
561
+ .setGetter('getGravityY');
562
+
563
+ aut
564
+ .addExpressionAndConditionAndAction(
565
+ 'number',
566
+ 'GravityZ',
567
+ _('World gravity on Z axis'),
568
+ _('the world gravity on Z axis') +
569
+ ' ' +
570
+ _(
571
+ 'While an object is needed, this will apply to all objects using the behavior.'
572
+ ),
573
+ _('the world gravity on Z axis'),
574
+ _('Global'),
575
+ 'JsPlatform/Extensions/physics3d.svg'
576
+ )
577
+ .addParameter('object', _('Object'), '', false)
578
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
579
+ .useStandardParameters(
580
+ 'number',
581
+ gd.ParameterOptions.makeNewOptions().setDescription(
582
+ _('Gravity (in Newton)')
583
+ )
584
+ )
585
+ .setFunctionName('setGravityZ')
586
+ .setGetter('getGravityZ');
587
+
588
+ aut
589
+ .addScopedCondition(
590
+ 'IsDynamic',
591
+ _('Is dynamic'),
592
+ _('Check if an object is dynamic.'),
593
+ _('_PARAM0_ is dynamic'),
594
+ _('Dynamics'),
595
+ 'JsPlatform/Extensions/physics3d.svg',
596
+ 'JsPlatform/Extensions/physics3d.svg'
597
+ )
598
+ .addParameter('object', _('Object'), '', false)
599
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
600
+ .getCodeExtraInformation()
601
+ .setFunctionName('isDynamic');
602
+
603
+ aut
604
+ .addScopedCondition(
605
+ 'IsStatic',
606
+ _('Is static'),
607
+ _('Check if an object is static.'),
608
+ _('_PARAM0_ is static'),
609
+ _('Dynamics'),
610
+ 'JsPlatform/Extensions/physics3d.svg',
611
+ 'JsPlatform/Extensions/physics3d.svg'
612
+ )
613
+ .addParameter('object', _('Object'), '', false)
614
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
615
+ .getCodeExtraInformation()
616
+ .setFunctionName('isStatic');
617
+
618
+ aut
619
+ .addScopedCondition(
620
+ 'IsKinematic',
621
+ _('Is kinematic'),
622
+ _('Check if an object is kinematic.'),
623
+ _('_PARAM0_ is kinematic'),
624
+ _('Dynamics'),
625
+ 'JsPlatform/Extensions/physics3d.svg',
626
+ 'JsPlatform/Extensions/physics3d.svg'
627
+ )
628
+ .addParameter('object', _('Object'), '', false)
629
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
630
+ .getCodeExtraInformation()
631
+ .setFunctionName('isKinematic');
632
+
633
+ aut
634
+ .addScopedCondition(
635
+ 'IsBullet',
636
+ _('Is treated as a bullet'),
637
+ _('Check if the object is being treated as a bullet.'),
638
+ _('_PARAM0_ is treated as a bullet'),
639
+ _('Dynamics'),
640
+ 'JsPlatform/Extensions/physics3d.svg',
641
+ 'JsPlatform/Extensions/physics3d.svg'
642
+ )
643
+ .addParameter('object', _('Object'), '', false)
644
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
645
+ .getCodeExtraInformation()
646
+ .setFunctionName('isBullet');
647
+
648
+ aut
649
+ .addScopedAction(
650
+ 'SetBullet',
651
+ _('Treat as bullet'),
652
+ _(
653
+ 'Treat the object as a bullet. Better collision handling on high speeds at cost of some performance.'
654
+ ),
655
+ _('Treat _PARAM0_ as bullet: _PARAM2_'),
656
+ _('Dynamics'),
657
+ 'JsPlatform/Extensions/physics3d.svg',
658
+ 'JsPlatform/Extensions/physics3d.svg'
659
+ )
660
+ .addParameter('object', _('Object'), '', false)
661
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
662
+ .addParameter('yesorno', _('Treat as bullet?'), '', false)
663
+ .setDefaultValue('false')
664
+ .getCodeExtraInformation()
665
+ .setFunctionName('setBullet');
666
+
667
+ aut
668
+ .addScopedCondition(
669
+ 'HasFixedRotation',
670
+ _('Has fixed rotation'),
671
+ _('Check if an object has fixed rotation.'),
672
+ _('_PARAM0_ has fixed rotation'),
673
+ _('Dynamics'),
674
+ 'JsPlatform/Extensions/physics3d.svg',
675
+ 'JsPlatform/Extensions/physics3d.svg'
676
+ )
677
+ .addParameter('object', _('Object'), '', false)
678
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
679
+ .getCodeExtraInformation()
680
+ .setFunctionName('hasFixedRotation');
681
+
682
+ aut
683
+ .addScopedAction(
684
+ 'SetFixedRotation',
685
+ _('Fixed rotation'),
686
+ _(
687
+ "Enable or disable an object fixed rotation. If enabled the object won't be able to rotate."
688
+ ),
689
+ _('Set _PARAM0_ fixed rotation: _PARAM2_'),
690
+ _('Dynamics'),
691
+ 'JsPlatform/Extensions/physics3d.svg',
692
+ 'JsPlatform/Extensions/physics3d.svg'
693
+ )
694
+ .addParameter('object', _('Object'), '', false)
695
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
696
+ .addParameter('yesorno', _('Fixed rotation?'), '', false)
697
+ .setDefaultValue('false')
698
+ .getCodeExtraInformation()
699
+ .setFunctionName('setFixedRotation');
700
+
701
+ // Body settings
702
+ aut
703
+ .addScopedAction(
704
+ 'ShapeScale',
705
+ _('Shape scale'),
706
+ _(
707
+ 'Modify an object shape scale. It affects custom shape dimensions, if custom dimensions are not set the body will be scaled automatically to the object size.'
708
+ ),
709
+ _('the shape scale'),
710
+ _('Body settings'),
711
+ 'JsPlatform/Extensions/physics3d.svg',
712
+ 'JsPlatform/Extensions/physics3d.svg'
713
+ )
714
+ .addParameter('object', _('Object'), '', false)
715
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
716
+ .useStandardOperatorParameters(
717
+ 'number',
718
+ gd.ParameterOptions.makeNewOptions().setDescription(
719
+ _('Scale (1 by default)')
720
+ )
721
+ )
722
+ .getCodeExtraInformation()
723
+ .setFunctionName('setShapeScale')
724
+ .setGetter('getShapeScale');
725
+
726
+ aut
727
+ .addExpressionAndConditionAndAction(
728
+ 'number',
729
+ 'Density',
730
+ _('Density'),
731
+ _(
732
+ "the object density. The body's density and volume determine its mass."
733
+ ),
734
+ _('the density'),
735
+ _('Body settings'),
736
+ 'JsPlatform/Extensions/physics3d.svg'
737
+ )
738
+ .addParameter('object', _('Object'), '', false)
739
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
740
+ .useStandardParameters('number', gd.ParameterOptions.makeNewOptions())
741
+ .setFunctionName('setDensity')
742
+ .setGetter('getDensity');
743
+
744
+ aut
745
+ .addExpressionAndConditionAndAction(
746
+ 'number',
747
+ 'Friction',
748
+ _('Friction'),
749
+ _(
750
+ "the object friction. How much energy is lost from the movement of one object over another. The combined friction from two bodies is calculated as 'sqrt(bodyA.friction * bodyB.friction)'."
751
+ ),
752
+ _('the friction'),
753
+ _('Body settings'),
754
+ 'JsPlatform/Extensions/physics3d.svg'
755
+ )
756
+ .addParameter('object', _('Object'), '', false)
757
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
758
+ .useStandardParameters('number', gd.ParameterOptions.makeNewOptions())
759
+ .setFunctionName('setFriction')
760
+ .setGetter('getFriction');
761
+
762
+ aut
763
+ .addExpressionAndConditionAndAction(
764
+ 'number',
765
+ 'Restitution',
766
+ _('Restitution'),
767
+ _(
768
+ "the object restitution. Energy conservation on collision. The combined restitution from two bodies is calculated as 'max(bodyA.restitution, bodyB.restitution)'."
769
+ ),
770
+ _('the restitution'),
771
+ _('Body settings'),
772
+ 'JsPlatform/Extensions/physics3d.svg'
773
+ )
774
+ .addParameter('object', _('Object'), '', false)
775
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
776
+ .useStandardParameters('number', gd.ParameterOptions.makeNewOptions())
777
+ .setFunctionName('setRestitution')
778
+ .setGetter('getRestitution');
779
+
780
+ aut
781
+ .addExpressionAndConditionAndAction(
782
+ 'number',
783
+ 'LinearDamping',
784
+ _('Linear damping'),
785
+ _(
786
+ 'the object linear damping. How much movement speed is lost across the time.'
787
+ ),
788
+ _('the linear damping'),
789
+ _('Body settings'),
790
+ 'JsPlatform/Extensions/physics3d.svg'
791
+ )
792
+ .addParameter('object', _('Object'), '', false)
793
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
794
+ .useStandardParameters('number', gd.ParameterOptions.makeNewOptions())
795
+ .setFunctionName('setLinearDamping')
796
+ .setGetter('getLinearDamping');
797
+
798
+ aut
799
+ .addExpressionAndConditionAndAction(
800
+ 'number',
801
+ 'AngularDamping',
802
+ _('Angular damping'),
803
+ _(
804
+ 'the object angular damping. How much angular speed is lost across the time.'
805
+ ),
806
+ _('the angular damping'),
807
+ _('Body settings'),
808
+ 'JsPlatform/Extensions/physics3d.svg'
809
+ )
810
+ .addParameter('object', _('Object'), '', false)
811
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
812
+ .useStandardParameters('number', gd.ParameterOptions.makeNewOptions())
813
+ .setFunctionName('setAngularDamping')
814
+ .setGetter('getAngularDamping');
815
+
816
+ aut
817
+ .addExpressionAndConditionAndAction(
818
+ 'number',
819
+ 'GravityScale',
820
+ _('Gravity scale'),
821
+ _(
822
+ 'the object gravity scale. The gravity applied to an object is the world gravity multiplied by the object gravity scale.'
823
+ ),
824
+ _('the gravity scale'),
825
+ _('Body settings'),
826
+ 'JsPlatform/Extensions/physics3d.svg'
827
+ )
828
+ .addParameter('object', _('Object'), '', false)
829
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
830
+ .useStandardParameters(
831
+ 'number',
832
+ gd.ParameterOptions.makeNewOptions().setDescription(
833
+ _('Scale (1 by default)')
834
+ )
835
+ )
836
+ .setFunctionName('setGravityScale')
837
+ .setGetter('getGravityScale');
838
+
839
+ // Filtering
840
+ aut
841
+ .addScopedCondition(
842
+ 'LayerEnabled',
843
+ _('Layer enabled'),
844
+ _('Check if an object has a specific layer enabled.'),
845
+ _('_PARAM0_ has layer _PARAM2_ enabled'),
846
+ _('Filtering'),
847
+ 'JsPlatform/Extensions/physics3d.svg',
848
+ 'JsPlatform/Extensions/physics3d.svg'
849
+ )
850
+ .addParameter('object', _('Object'), '', false)
851
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
852
+ .addParameter('expression', _('Layer (1 - 8)'))
853
+ .getCodeExtraInformation()
854
+ .setFunctionName('layerEnabled');
855
+
856
+ aut
857
+ .addScopedAction(
858
+ 'EnableLayer',
859
+ _('Enable layer'),
860
+ _(
861
+ 'Enable or disable a layer for an object. Two objects collide if any layer of the first object matches any mask of the second one and vice versa.'
862
+ ),
863
+ _('Enable layer _PARAM2_ for _PARAM0_: _PARAM3_'),
864
+ _('Filtering'),
865
+ 'JsPlatform/Extensions/physics3d.svg',
866
+ 'JsPlatform/Extensions/physics3d.svg'
867
+ )
868
+ .addParameter('object', _('Object'), '', false)
869
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
870
+ .addParameter('expression', _('Layer (1 - 8)'))
871
+ .addParameter('yesorno', _('Enable?'), '', false)
872
+ .setDefaultValue('true')
873
+ .getCodeExtraInformation()
874
+ .setFunctionName('enableLayer');
875
+
876
+ aut
877
+ .addScopedCondition(
878
+ 'MaskEnabled',
879
+ _('Mask enabled'),
880
+ _('Check if an object has a specific mask enabled.'),
881
+ _('_PARAM0_ has mask _PARAM2_ enabled'),
882
+ _('Filtering'),
883
+ 'JsPlatform/Extensions/physics3d.svg',
884
+ 'JsPlatform/Extensions/physics3d.svg'
885
+ )
886
+ .addParameter('object', _('Object'), '', false)
887
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
888
+ .addParameter('expression', _('Mask (1 - 8)'))
889
+ .getCodeExtraInformation()
890
+ .setFunctionName('maskEnabled');
891
+
892
+ aut
893
+ .addScopedAction(
894
+ 'EnableMask',
895
+ _('Enable mask'),
896
+ _(
897
+ 'Enable or disable a mask for an object. Two objects collide if any layer of the first object matches any mask of the second one and vice versa.'
898
+ ),
899
+ _('Enable mask _PARAM2_ for _PARAM0_: _PARAM3_'),
900
+ _('Filtering'),
901
+ 'JsPlatform/Extensions/physics3d.svg',
902
+ 'JsPlatform/Extensions/physics3d.svg'
903
+ )
904
+ .addParameter('object', _('Object'), '', false)
905
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
906
+ .addParameter('expression', _('Mask (1 - 8)'))
907
+ .addParameter('yesorno', _('Enable?'), '', false)
908
+ .setDefaultValue('true')
909
+ .getCodeExtraInformation()
910
+ .setFunctionName('enableMask');
911
+
912
+ // Velocity
913
+ aut
914
+ .addExpressionAndConditionAndAction(
915
+ 'number',
916
+ 'LinearVelocityX',
917
+ _('Linear velocity X'),
918
+ _('the object linear velocity on X.'),
919
+ _('the linear velocity on X'),
920
+ _('Velocity'),
921
+ 'JsPlatform/Extensions/physics3d.svg'
922
+ )
923
+ .addParameter('object', _('Object'), '', false)
924
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
925
+ .useStandardParameters(
926
+ 'number',
927
+ gd.ParameterOptions.makeNewOptions().setDescription(
928
+ _('Speed (in pixels per second)')
929
+ )
930
+ )
931
+ .setFunctionName('setLinearVelocityX')
932
+ .setGetter('getLinearVelocityX');
933
+
934
+ aut
935
+ .addExpressionAndConditionAndAction(
936
+ 'number',
937
+ 'LinearVelocityY',
938
+ _('Linear velocity Y'),
939
+ _('the object linear velocity on Y.'),
940
+ _('the linear velocity on Y'),
941
+ _('Velocity'),
942
+ 'JsPlatform/Extensions/physics3d.svg'
943
+ )
944
+ .addParameter('object', _('Object'), '', false)
945
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
946
+ .useStandardParameters(
947
+ 'number',
948
+ gd.ParameterOptions.makeNewOptions().setDescription(
949
+ _('Speed (in pixels per second)')
950
+ )
951
+ )
952
+ .setFunctionName('setLinearVelocityY')
953
+ .setGetter('getLinearVelocityY');
954
+
955
+ aut
956
+ .addExpressionAndConditionAndAction(
957
+ 'number',
958
+ 'LinearVelocityZ',
959
+ _('Linear velocity Z'),
960
+ _('the object linear velocity on Z.'),
961
+ _('the linear velocity on Z'),
962
+ _('Velocity'),
963
+ 'JsPlatform/Extensions/physics3d.svg'
964
+ )
965
+ .addParameter('object', _('Object'), '', false)
966
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
967
+ .useStandardParameters(
968
+ 'number',
969
+ gd.ParameterOptions.makeNewOptions().setDescription(
970
+ _('Speed (in pixels per second)')
971
+ )
972
+ )
973
+ .setFunctionName('setLinearVelocityZ')
974
+ .setGetter('getLinearVelocityZ');
975
+
976
+ aut
977
+ .addExpressionAndCondition(
978
+ 'number',
979
+ 'LinearVelocityLength',
980
+ _('Linear velocity'),
981
+ _('the object linear velocity length.'),
982
+ _('the linear velocity length'),
983
+ _('Velocity'),
984
+ 'JsPlatform/Extensions/physics3d.svg'
985
+ )
986
+ .addParameter('object', _('Object'), '', false)
987
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
988
+ .useStandardParameters(
989
+ 'number',
990
+ gd.ParameterOptions.makeNewOptions().setDescription(
991
+ _('Speed to compare to (in pixels per second)')
992
+ )
993
+ )
994
+ .setFunctionName('getLinearVelocityLength');
995
+
996
+ aut
997
+ .addExpressionAndConditionAndAction(
998
+ 'number',
999
+ 'AngularVelocityX',
1000
+ _('Angular velocity X'),
1001
+ _('the object angular velocity on X.'),
1002
+ _('the angular velocity on X'),
1003
+ _('Velocity'),
1004
+ 'JsPlatform/Extensions/physics3d.svg'
1005
+ )
1006
+ .addParameter('object', _('Object'), '', false)
1007
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1008
+ .useStandardParameters(
1009
+ 'number',
1010
+ gd.ParameterOptions.makeNewOptions().setDescription(
1011
+ _('Angular speed (in degrees per second)')
1012
+ )
1013
+ )
1014
+ .setFunctionName('setAngularVelocityX')
1015
+ .setGetter('getAngularVelocityX');
1016
+
1017
+ aut
1018
+ .addExpressionAndConditionAndAction(
1019
+ 'number',
1020
+ 'AngularVelocityY',
1021
+ _('Angular velocity Y'),
1022
+ _('the object angular velocity on Y.'),
1023
+ _('the angular velocity on Y'),
1024
+ _('Velocity'),
1025
+ 'JsPlatform/Extensions/physics3d.svg'
1026
+ )
1027
+ .addParameter('object', _('Object'), '', false)
1028
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1029
+ .useStandardParameters(
1030
+ 'number',
1031
+ gd.ParameterOptions.makeNewOptions().setDescription(
1032
+ _('Angular speed (in degrees per second)')
1033
+ )
1034
+ )
1035
+ .setFunctionName('setAngularVelocityY')
1036
+ .setGetter('getAngularVelocityY');
1037
+
1038
+ aut
1039
+ .addExpressionAndConditionAndAction(
1040
+ 'number',
1041
+ 'AngularVelocityZ',
1042
+ _('Angular velocity Z'),
1043
+ _('the object angular velocity on Z.'),
1044
+ _('the angular velocity on Z'),
1045
+ _('Velocity'),
1046
+ 'JsPlatform/Extensions/physics3d.svg'
1047
+ )
1048
+ .addParameter('object', _('Object'), '', false)
1049
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1050
+ .useStandardParameters(
1051
+ 'number',
1052
+ gd.ParameterOptions.makeNewOptions().setDescription(
1053
+ _('Angular speed (in degrees per second)')
1054
+ )
1055
+ )
1056
+ .setFunctionName('setAngularVelocityZ')
1057
+ .setGetter('getAngularVelocityZ');
1058
+
1059
+ // Forces and impulses
1060
+ aut
1061
+ .addScopedAction(
1062
+ 'ApplyForce',
1063
+ _('Apply force (at a point)'),
1064
+ _(
1065
+ 'Apply a force to the object over time. It "accelerates" an object and must be used every frame during a time period.'
1066
+ ),
1067
+ _(
1068
+ 'Apply a force of _PARAM2_ ; _PARAM3_ ; _PARAM4_ to _PARAM0_ at _PARAM5_ ; _PARAM6_ ; _PARAM7_'
1069
+ ),
1070
+ _('Forces & impulses'),
1071
+ 'JsPlatform/Extensions/physics3d.svg',
1072
+ 'JsPlatform/Extensions/physics3d.svg'
1073
+ )
1074
+ .addParameter('object', _('Object'), '', false)
1075
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1076
+ .addParameter('expression', _('X component (N)'))
1077
+ .addParameter('expression', _('Y component (N)'))
1078
+ .addParameter('expression', _('Z component (N)'))
1079
+ .setParameterLongDescription(
1080
+ _('A force is like an acceleration but depends on the mass.')
1081
+ )
1082
+ .addParameter('expression', _('Application point on X axis'))
1083
+ .addParameter('expression', _('Application point on Y axis'))
1084
+ .addParameter('expression', _('Application point on Z axis'))
1085
+ .setParameterLongDescription(
1086
+ _(
1087
+ 'Use `MassCenterX` and `MassCenterY` expressions to avoid any rotation.'
1088
+ )
1089
+ )
1090
+ .getCodeExtraInformation()
1091
+ .setFunctionName('applyForce');
1092
+
1093
+ aut
1094
+ .addScopedAction(
1095
+ 'ApplyForceAtCenter',
1096
+ _('Apply force (at center)'),
1097
+ _(
1098
+ 'Apply a force to the object over time. It "accelerates" an object and must be used every frame during a time period.'
1099
+ ),
1100
+ _(
1101
+ 'Apply a force of _PARAM2_ ; _PARAM3_ ; _PARAM4_ at the center of _PARAM0_'
1102
+ ),
1103
+ _('Forces & impulses'),
1104
+ 'JsPlatform/Extensions/physics3d.svg',
1105
+ 'JsPlatform/Extensions/physics3d.svg'
1106
+ )
1107
+ .addParameter('object', _('Object'), '', false)
1108
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1109
+ .addParameter('expression', _('X component (N)'))
1110
+ .addParameter('expression', _('Y component (N)'))
1111
+ .addParameter('expression', _('Z component (N)'))
1112
+ .setParameterLongDescription(
1113
+ _('A force is like an acceleration but depends on the mass.')
1114
+ )
1115
+ .getCodeExtraInformation()
1116
+ .setFunctionName('applyForceAtCenter');
1117
+
1118
+ aut
1119
+ .addScopedAction(
1120
+ 'ApplyForceTowardPosition',
1121
+ _('Apply force toward position'),
1122
+ _(
1123
+ 'Apply a force to the object over time to move it toward a position. It "accelerates" an object and must be used every frame during a time period.'
1124
+ ),
1125
+ _(
1126
+ 'Apply to _PARAM0_ a force of length _PARAM2_ towards _PARAM3_ ; _PARAM4_ ; _PARAM5_'
1127
+ ),
1128
+ _('Forces & impulses'),
1129
+ 'JsPlatform/Extensions/physics3d.svg',
1130
+ 'JsPlatform/Extensions/physics3d.svg'
1131
+ )
1132
+ .addParameter('object', _('Object'), '', false)
1133
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1134
+ .addParameter('expression', _('Length (N)'))
1135
+ .setParameterLongDescription(
1136
+ _('A force is like an acceleration but depends on the mass.')
1137
+ )
1138
+ .addParameter('expression', _('X position'))
1139
+ .addParameter('expression', _('Y position'))
1140
+ .addParameter('expression', _('Z position'))
1141
+ .getCodeExtraInformation()
1142
+ .setFunctionName('applyForceTowardPosition');
1143
+
1144
+ aut
1145
+ .addScopedAction(
1146
+ 'ApplyImpulse',
1147
+ _('Apply impulse (at a point)'),
1148
+ _(
1149
+ 'Apply an impulse to the object. It instantly changes the speed, to give an initial speed for instance.'
1150
+ ),
1151
+ _(
1152
+ 'Apply an impulse of _PARAM2_ ; _PARAM3_ ; _PARAM4_ to _PARAM0_ at _PARAM5_ ; _PARAM6_ ; _PARAM7_'
1153
+ ),
1154
+ _('Forces & impulses'),
1155
+ 'JsPlatform/Extensions/physics3d.svg',
1156
+ 'JsPlatform/Extensions/physics3d.svg'
1157
+ )
1158
+ .addParameter('object', _('Object'), '', false)
1159
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1160
+ .addParameter('expression', _('X component (N·s or kg·m·s⁻¹)'))
1161
+ .addParameter('expression', _('Y component (N·s or kg·m·s⁻¹)'))
1162
+ .addParameter('expression', _('Z component (N·s or kg·m·s⁻¹)'))
1163
+ .setParameterLongDescription(
1164
+ _('An impulse is like a speed addition but depends on the mass.')
1165
+ )
1166
+ .addParameter('expression', _('Application point on X axis'))
1167
+ .addParameter('expression', _('Application point on Y axis'))
1168
+ .addParameter('expression', _('Application point on Z axis'))
1169
+ .setParameterLongDescription(
1170
+ _(
1171
+ 'Use `MassCenterX`, `MassCenterY` and `MassCenterZ` expressions to avoid any rotation.'
1172
+ )
1173
+ )
1174
+ .getCodeExtraInformation()
1175
+ .setFunctionName('applyImpulse');
1176
+
1177
+ aut
1178
+ .addScopedAction(
1179
+ 'ApplyImpulseAtCenter',
1180
+ _('Apply impulse (at center)'),
1181
+ _(
1182
+ 'Apply an impulse to the object. It instantly changes the speed, to give an initial speed for instance.'
1183
+ ),
1184
+ _(
1185
+ 'Apply an impulse of _PARAM2_ ; _PARAM3_ ; _PARAM4_ at the center of _PARAM0_'
1186
+ ),
1187
+ _('Forces & impulses'),
1188
+ 'JsPlatform/Extensions/physics3d.svg',
1189
+ 'JsPlatform/Extensions/physics3d.svg'
1190
+ )
1191
+ .addParameter('object', _('Object'), '', false)
1192
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1193
+ .addParameter('expression', _('X component (N·s or kg·m·s⁻¹)'))
1194
+ .addParameter('expression', _('Y component (N·s or kg·m·s⁻¹)'))
1195
+ .addParameter('expression', _('Z component (N·s or kg·m·s⁻¹)'))
1196
+ .setParameterLongDescription(
1197
+ _('An impulse is like a speed addition but depends on the mass.')
1198
+ )
1199
+ .getCodeExtraInformation()
1200
+ .setFunctionName('applyImpulseAtCenter');
1201
+
1202
+ aut
1203
+ .addScopedAction(
1204
+ 'ApplyImpulseTowardPosition',
1205
+ _('Apply impulse toward position'),
1206
+ _(
1207
+ 'Apply an impulse to the object to move it toward a position. It instantly changes the speed, to give an initial speed for instance.'
1208
+ ),
1209
+ _(
1210
+ 'Apply to _PARAM0_ an impulse of length _PARAM2_ towards _PARAM3_ ; _PARAM4_ ; _PARAM5_'
1211
+ ),
1212
+ _('Forces & impulses'),
1213
+ 'JsPlatform/Extensions/physics3d.svg',
1214
+ 'JsPlatform/Extensions/physics3d.svg'
1215
+ )
1216
+ .addParameter('object', _('Object'), '', false)
1217
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1218
+ .addParameter('expression', _('Length (N·s or kg·m·s⁻¹)'))
1219
+ .setParameterLongDescription(
1220
+ _('An impulse is like a speed addition but depends on the mass.')
1221
+ )
1222
+ .addParameter('expression', _('X position'))
1223
+ .addParameter('expression', _('Y position'))
1224
+ .addParameter('expression', _('Z position'))
1225
+ .getCodeExtraInformation()
1226
+ .setFunctionName('applyImpulseTowardPosition');
1227
+
1228
+ aut
1229
+ .addScopedAction(
1230
+ 'ApplyTorque',
1231
+ _('Apply torque (rotational force)'),
1232
+ _(
1233
+ 'Apply a torque (also called "rotational force") to the object. It "accelerates" an object rotation and must be used every frame during a time period.'
1234
+ ),
1235
+ _('Apply a torque of _PARAM2_ ; _PARAM3_ ; _PARAM4_ to _PARAM0_ an'),
1236
+ _('Forces & impulses'),
1237
+ 'JsPlatform/Extensions/physics3d.svg',
1238
+ 'JsPlatform/Extensions/physics3d.svg'
1239
+ )
1240
+ .addParameter('object', _('Object'), '', false)
1241
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1242
+ .addParameter('expression', _('Torque around X (N·m)'))
1243
+ .addParameter('expression', _('Torque around Y (N·m)'))
1244
+ .addParameter('expression', _('Torque around Z (N·m)'))
1245
+ .setParameterLongDescription(
1246
+ _('A torque is like a rotation acceleration but depends on the mass.')
1247
+ )
1248
+ .getCodeExtraInformation()
1249
+ .setFunctionName('applyTorque');
1250
+
1251
+ aut
1252
+ .addScopedAction(
1253
+ 'ApplyAngularImpulse',
1254
+ _('Apply angular impulse (rotational impulse)'),
1255
+ _(
1256
+ 'Apply an angular impulse (also called a "rotational impulse") to the object. It instantly changes the rotation speed, to give an initial speed for instance.'
1257
+ ),
1258
+ _(
1259
+ 'Apply angular impulse of _PARAM2_ ; _PARAM3_ ; _PARAM4_ to _PARAM0_ an'
1260
+ ),
1261
+ _('Forces & impulses'),
1262
+ 'JsPlatform/Extensions/physics3d.svg',
1263
+ 'JsPlatform/Extensions/physics3d.svg'
1264
+ )
1265
+ .addParameter('object', _('Object'), '', false)
1266
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1267
+ .addParameter('expression', _('Angular impulse around X (N·m·s)'))
1268
+ .addParameter('expression', _('Angular impulse around Y (N·m·s)'))
1269
+ .addParameter('expression', _('Angular impulse around Z (N·m·s)'))
1270
+ .setParameterLongDescription(
1271
+ _(
1272
+ 'An impulse is like a rotation speed addition but depends on the mass.'
1273
+ )
1274
+ )
1275
+ .getCodeExtraInformation()
1276
+ .setFunctionName('applyAngularImpulse');
1277
+
1278
+ aut
1279
+ .addExpression(
1280
+ 'Mass',
1281
+ _('Mass'),
1282
+ _('Return the mass of the object (in kilograms)'),
1283
+ '',
1284
+ 'JsPlatform/Extensions/physics3d.svg'
1285
+ )
1286
+ .addParameter('object', _('Object'), '', false)
1287
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1288
+ .getCodeExtraInformation()
1289
+ .setFunctionName('getMass');
1290
+
1291
+ aut
1292
+ .addExpression(
1293
+ 'InertiaAroundX',
1294
+ _('Inertia around X'),
1295
+ _(
1296
+ 'Return the inertia around X axis of the object (in kilograms · meters²) when for its default rotation is (0°; 0°; 0°)'
1297
+ ),
1298
+ '',
1299
+ 'JsPlatform/Extensions/physics3d.svg'
1300
+ )
1301
+ .addParameter('object', _('Object'), '', false)
1302
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1303
+ .getCodeExtraInformation()
1304
+ .setFunctionName('getInertiaAroundX');
1305
+
1306
+ aut
1307
+ .addExpression(
1308
+ 'InertiaAroundY',
1309
+ _('Inertia around Y'),
1310
+ _(
1311
+ 'Return the inertia around Y axis of the object (in kilograms · meters²) when for its default rotation is (0°; 0°; 0°)'
1312
+ ),
1313
+ '',
1314
+ 'JsPlatform/Extensions/physics3d.svg'
1315
+ )
1316
+ .addParameter('object', _('Object'), '', false)
1317
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1318
+ .getCodeExtraInformation()
1319
+ .setFunctionName('getInertiaAroundY');
1320
+
1321
+ aut
1322
+ .addExpression(
1323
+ 'InertiaAroundZ',
1324
+ _('Inertia around Z'),
1325
+ _(
1326
+ 'Return the inertia around Z axis of the object (in kilograms · meters²) when for its default rotation is (0°; 0°; 0°)'
1327
+ ),
1328
+ '',
1329
+ 'JsPlatform/Extensions/physics3d.svg'
1330
+ )
1331
+ .addParameter('object', _('Object'), '', false)
1332
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1333
+ .getCodeExtraInformation()
1334
+ .setFunctionName('getInertiaAroundZ');
1335
+
1336
+ aut
1337
+ .addExpression(
1338
+ 'MassCenterX',
1339
+ _('Mass center X'),
1340
+ _('Mass center X'),
1341
+ '',
1342
+ 'JsPlatform/Extensions/physics3d.svg'
1343
+ )
1344
+ .addParameter('object', _('Object'), '', false)
1345
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1346
+ .getCodeExtraInformation()
1347
+ .setFunctionName('getMassCenterX');
1348
+
1349
+ aut
1350
+ .addExpression(
1351
+ 'MassCenterY',
1352
+ _('Mass center Y'),
1353
+ _('Mass center Y'),
1354
+ '',
1355
+ 'JsPlatform/Extensions/physics3d.svg'
1356
+ )
1357
+ .addParameter('object', _('Object'), '', false)
1358
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1359
+ .getCodeExtraInformation()
1360
+ .setFunctionName('getMassCenterY');
1361
+ }
1362
+ // Collision
1363
+ extension
1364
+ .addCondition(
1365
+ 'Collision',
1366
+ _('Collision'),
1367
+ _('Check if two objects collide.'),
1368
+ _('_PARAM0_ is colliding with _PARAM2_'),
1369
+ '',
1370
+ 'JsPlatform/Extensions/physics3d.svg',
1371
+ 'JsPlatform/Extensions/physics3d.svg'
1372
+ )
1373
+ .addParameter('objectList', _('Object'), '', false)
1374
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1375
+ .addParameter('objectList', _('Object'), '', false)
1376
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1377
+ .addCodeOnlyParameter('conditionInverted', '')
1378
+ .getCodeExtraInformation()
1379
+ .addIncludeFile('Extensions/Physics3DBehavior/Physics3DTools.js')
1380
+ .addIncludeFile(
1381
+ 'Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js'
1382
+ )
1383
+ .setFunctionName('gdjs.physics3d.areObjectsColliding');
1384
+
1385
+ extension
1386
+ .addCondition(
1387
+ 'CollisionStarted',
1388
+ _('Collision started'),
1389
+ _('Check if two objects just started colliding during this frame.'),
1390
+ _('_PARAM0_ started colliding with _PARAM2_'),
1391
+ _('Collision'),
1392
+ 'JsPlatform/Extensions/physics3d.svg',
1393
+ 'JsPlatform/Extensions/physics3d.svg'
1394
+ )
1395
+ .addParameter('objectList', _('Object'), '', false)
1396
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1397
+ .addParameter('objectList', _('Object'), '', false)
1398
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1399
+ .addCodeOnlyParameter('conditionInverted', '')
1400
+ .getCodeExtraInformation()
1401
+ .addIncludeFile('Extensions/Physics3DBehavior/Physics3DTools.js')
1402
+ .addIncludeFile(
1403
+ 'Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js'
1404
+ )
1405
+ .setFunctionName('gdjs.physics3d.haveObjectsStartedColliding');
1406
+
1407
+ extension
1408
+ .addCondition(
1409
+ 'CollisionStopped',
1410
+ _('Collision stopped'),
1411
+ _('Check if two objects just stopped colliding at this frame.'),
1412
+ _('_PARAM0_ stopped colliding with _PARAM2_'),
1413
+ _('Collision'),
1414
+ 'JsPlatform/Extensions/physics3d.svg',
1415
+ 'JsPlatform/Extensions/physics3d.svg'
1416
+ )
1417
+ .addParameter('objectList', _('Object'), '', false)
1418
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1419
+ .addParameter('objectList', _('Object'), '', false)
1420
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
1421
+ .addCodeOnlyParameter('conditionInverted', '')
1422
+ .getCodeExtraInformation()
1423
+ .addIncludeFile('Extensions/Physics3DBehavior/Physics3DTools.js')
1424
+ .addIncludeFile(
1425
+ 'Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js'
1426
+ )
1427
+ .setFunctionName('gdjs.physics3d.haveObjectsStoppedColliding');
1428
+
1429
+ {
1430
+ const behavior = new gd.BehaviorJsImplementation();
1431
+ behavior.updateProperty = function (
1432
+ behaviorContent,
1433
+ propertyName,
1434
+ newValue
1435
+ ) {
1436
+ if (propertyName === 'physics3D') {
1437
+ behaviorContent.getChild('physics3D').setStringValue(newValue);
1438
+ return true;
1439
+ }
1440
+
1441
+ if (propertyName === 'jumpHeight') {
1442
+ const newValueAsNumber = parseFloat(newValue);
1443
+ if (newValueAsNumber !== newValueAsNumber) return false;
1444
+ behaviorContent
1445
+ .getChild('jumpHeight')
1446
+ .setDoubleValue(newValueAsNumber);
1447
+ return true;
1448
+ }
1449
+
1450
+ if (propertyName === 'jumpSustainTime') {
1451
+ const newValueAsNumber = parseFloat(newValue);
1452
+ if (newValueAsNumber !== newValueAsNumber) return false;
1453
+ behaviorContent
1454
+ .getChild('jumpSustainTime')
1455
+ .setDoubleValue(newValueAsNumber);
1456
+ return true;
1457
+ }
1458
+
1459
+ if (propertyName === 'gravity') {
1460
+ const newValueAsNumber = parseFloat(newValue);
1461
+ if (newValueAsNumber !== newValueAsNumber) return false;
1462
+ behaviorContent.getChild('gravity').setDoubleValue(newValueAsNumber);
1463
+ return true;
1464
+ }
1465
+
1466
+ if (propertyName === 'fallingSpeedMax') {
1467
+ const newValueAsNumber = parseFloat(newValue);
1468
+ if (newValueAsNumber !== newValueAsNumber) return false;
1469
+ behaviorContent
1470
+ .getChild('fallingSpeedMax')
1471
+ .setDoubleValue(newValueAsNumber);
1472
+ return true;
1473
+ }
1474
+
1475
+ if (propertyName === 'forwardAcceleration') {
1476
+ const newValueAsNumber = parseFloat(newValue);
1477
+ if (newValueAsNumber !== newValueAsNumber) return false;
1478
+ behaviorContent
1479
+ .getChild('forwardAcceleration')
1480
+ .setDoubleValue(newValueAsNumber);
1481
+ return true;
1482
+ }
1483
+
1484
+ if (propertyName === 'forwardDeceleration') {
1485
+ const newValueAsNumber = parseFloat(newValue);
1486
+ if (newValueAsNumber !== newValueAsNumber) return false;
1487
+ behaviorContent
1488
+ .getChild('forwardDeceleration')
1489
+ .setDoubleValue(newValueAsNumber);
1490
+ return true;
1491
+ }
1492
+
1493
+ if (propertyName === 'forwardSpeedMax') {
1494
+ const newValueAsNumber = parseFloat(newValue);
1495
+ if (newValueAsNumber !== newValueAsNumber) return false;
1496
+ behaviorContent
1497
+ .getChild('forwardSpeedMax')
1498
+ .setDoubleValue(newValueAsNumber);
1499
+ return true;
1500
+ }
1501
+
1502
+ if (propertyName === 'sidewaysAcceleration') {
1503
+ const newValueAsNumber = parseFloat(newValue);
1504
+ if (newValueAsNumber !== newValueAsNumber) return false;
1505
+ behaviorContent
1506
+ .getChild('sidewaysAcceleration')
1507
+ .setDoubleValue(newValueAsNumber);
1508
+ return true;
1509
+ }
1510
+
1511
+ if (propertyName === 'sidewaysDeceleration') {
1512
+ const newValueAsNumber = parseFloat(newValue);
1513
+ if (newValueAsNumber !== newValueAsNumber) return false;
1514
+ behaviorContent
1515
+ .getChild('sidewaysDeceleration')
1516
+ .setDoubleValue(newValueAsNumber);
1517
+ return true;
1518
+ }
1519
+
1520
+ if (propertyName === 'sidewaysSpeedMax') {
1521
+ const newValueAsNumber = parseFloat(newValue);
1522
+ if (newValueAsNumber !== newValueAsNumber) return false;
1523
+ behaviorContent
1524
+ .getChild('sidewaysSpeedMax')
1525
+ .setDoubleValue(newValueAsNumber);
1526
+ return true;
1527
+ }
1528
+
1529
+ if (propertyName === 'slopeMaxAngle') {
1530
+ const newValueAsNumber = parseFloat(newValue);
1531
+ if (newValueAsNumber !== newValueAsNumber) return false;
1532
+ behaviorContent
1533
+ .getChild('slopeMaxAngle')
1534
+ .setDoubleValue(newValueAsNumber);
1535
+ return true;
1536
+ }
1537
+
1538
+ if (propertyName === 'stairHeightMax') {
1539
+ const newValueAsNumber = parseFloat(newValue);
1540
+ if (newValueAsNumber !== newValueAsNumber) return false;
1541
+ behaviorContent
1542
+ .getChild('stairHeightMax')
1543
+ .setDoubleValue(newValueAsNumber);
1544
+ return true;
1545
+ }
1546
+
1547
+ if (propertyName === 'shouldBindObjectAndForwardAngle') {
1548
+ behaviorContent
1549
+ .getChild('shouldBindObjectAndForwardAngle')
1550
+ .setBoolValue(newValue === '1');
1551
+ return true;
1552
+ }
1553
+
1554
+ return false;
1555
+ };
1556
+ behavior.getProperties = function (behaviorContent) {
1557
+ const behaviorProperties = new gd.MapStringPropertyDescriptor();
1558
+
1559
+ behaviorProperties
1560
+ .getOrCreate('physics3D')
1561
+ .setValue(behaviorContent.getChild('physics3D').getStringValue())
1562
+ .setType('Behavior')
1563
+ .setLabel('3D capability')
1564
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden)
1565
+ .addExtraInfo('Physics3D::Physics3DBehavior');
1566
+
1567
+ behaviorProperties
1568
+ .getOrCreate('jumpHeight')
1569
+ .setLabel(_('Jump height'))
1570
+ .setGroup(_('Jump'))
1571
+ .setType('Number')
1572
+ .setMeasurementUnit(gd.MeasurementUnit.getPixel())
1573
+ .setValue(
1574
+ behaviorContent.getChild('jumpHeight').getDoubleValue().toString(10)
1575
+ );
1576
+
1577
+ behaviorProperties
1578
+ .getOrCreate('jumpSustainTime')
1579
+ .setLabel(_('Jump sustain time'))
1580
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden)
1581
+ .setGroup(_('Jump'))
1582
+ .setType('Number')
1583
+ .setMeasurementUnit(gd.MeasurementUnit.getSecond())
1584
+ .setValue(
1585
+ behaviorContent
1586
+ .getChild('jumpSustainTime')
1587
+ .getDoubleValue()
1588
+ .toString(10)
1589
+ )
1590
+ .setDescription(
1591
+ _(
1592
+ 'Maximum time (in seconds) during which the jump strength is sustained if the jump key is held - allowing variable height jumps.'
1593
+ )
1594
+ );
1595
+
1596
+ behaviorProperties
1597
+ .getOrCreate('gravity')
1598
+ .setLabel(_('Gravity'))
1599
+ .setGroup(_('Jump'))
1600
+ .setType('Number')
1601
+ .setMeasurementUnit(gd.MeasurementUnit.getPixelAcceleration())
1602
+ .setValue(
1603
+ behaviorContent.getChild('gravity').getDoubleValue().toString(10)
1604
+ );
1605
+
1606
+ behaviorProperties
1607
+ .getOrCreate('fallingSpeedMax')
1608
+ .setLabel(_('Max. falling speed'))
1609
+ .setGroup(_('Jump'))
1610
+ .setType('Number')
1611
+ .setMeasurementUnit(gd.MeasurementUnit.getPixelSpeed())
1612
+ .setValue(
1613
+ behaviorContent
1614
+ .getChild('fallingSpeedMax')
1615
+ .getDoubleValue()
1616
+ .toString(10)
1617
+ );
1618
+
1619
+ behaviorProperties
1620
+ .getOrCreate('forwardAcceleration')
1621
+ .setLabel(_('Forward acceleration'))
1622
+ .setGroup(_('Walk'))
1623
+ .setType('Number')
1624
+ .setMeasurementUnit(gd.MeasurementUnit.getPixelAcceleration())
1625
+ .setValue(
1626
+ behaviorContent
1627
+ .getChild('forwardAcceleration')
1628
+ .getDoubleValue()
1629
+ .toString(10)
1630
+ );
1631
+
1632
+ behaviorProperties
1633
+ .getOrCreate('forwardDeceleration')
1634
+ .setLabel(_('Forward deceleration'))
1635
+ .setGroup(_('Walk'))
1636
+ .setType('Number')
1637
+ .setMeasurementUnit(gd.MeasurementUnit.getPixelAcceleration())
1638
+ .setValue(
1639
+ behaviorContent
1640
+ .getChild('forwardDeceleration')
1641
+ .getDoubleValue()
1642
+ .toString(10)
1643
+ );
1644
+
1645
+ behaviorProperties
1646
+ .getOrCreate('forwardSpeedMax')
1647
+ .setLabel(_('Max. forward speed'))
1648
+ .setGroup(_('Walk'))
1649
+ .setType('Number')
1650
+ .setMeasurementUnit(gd.MeasurementUnit.getPixelSpeed())
1651
+ .setValue(
1652
+ behaviorContent
1653
+ .getChild('forwardSpeedMax')
1654
+ .getDoubleValue()
1655
+ .toString(10)
1656
+ );
1657
+
1658
+ behaviorProperties
1659
+ .getOrCreate('sidewaysAcceleration')
1660
+ .setLabel(_('Sideways acceleration'))
1661
+ .setGroup(_('Walk'))
1662
+ .setType('Number')
1663
+ .setMeasurementUnit(gd.MeasurementUnit.getPixelAcceleration())
1664
+ .setValue(
1665
+ behaviorContent
1666
+ .getChild('sidewaysAcceleration')
1667
+ .getDoubleValue()
1668
+ .toString(10)
1669
+ )
1670
+ .setAdvanced(true);
1671
+
1672
+ behaviorProperties
1673
+ .getOrCreate('sidewaysDeceleration')
1674
+ .setLabel(_('Sideways deceleration'))
1675
+ .setGroup(_('Walk'))
1676
+ .setType('Number')
1677
+ .setMeasurementUnit(gd.MeasurementUnit.getPixelAcceleration())
1678
+ .setValue(
1679
+ behaviorContent
1680
+ .getChild('sidewaysDeceleration')
1681
+ .getDoubleValue()
1682
+ .toString(10)
1683
+ )
1684
+ .setAdvanced(true);
1685
+
1686
+ behaviorProperties
1687
+ .getOrCreate('sidewaysSpeedMax')
1688
+ .setLabel(_('Max. sideways speed'))
1689
+ .setGroup(_('Walk'))
1690
+ .setType('Number')
1691
+ .setMeasurementUnit(gd.MeasurementUnit.getPixelSpeed())
1692
+ .setValue(
1693
+ behaviorContent
1694
+ .getChild('sidewaysSpeedMax')
1695
+ .getDoubleValue()
1696
+ .toString(10)
1697
+ )
1698
+ .setAdvanced(true);
1699
+
1700
+ behaviorProperties
1701
+ .getOrCreate('slopeMaxAngle')
1702
+ .setLabel('Slope max. angle')
1703
+ .setGroup(_('Walk'))
1704
+ .setType('Number')
1705
+ .setMeasurementUnit(gd.MeasurementUnit.getDegreeAngle())
1706
+ .setValue(
1707
+ behaviorContent
1708
+ .getChild('slopeMaxAngle')
1709
+ .getDoubleValue()
1710
+ .toString(10)
1711
+ )
1712
+ .setAdvanced(true)
1713
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden);
1714
+
1715
+ if (!behaviorContent.hasChild('stairHeightMax')) {
1716
+ behaviorContent.addChild('stairHeightMax').setDoubleValue(20);
1717
+ }
1718
+ behaviorProperties
1719
+ .getOrCreate('stairHeightMax')
1720
+ .setLabel('Max. stair height')
1721
+ .setGroup(_('Walk'))
1722
+ .setType('Number')
1723
+ .setMeasurementUnit(gd.MeasurementUnit.getPixel())
1724
+ .setValue(
1725
+ behaviorContent
1726
+ .getChild('stairHeightMax')
1727
+ .getDoubleValue()
1728
+ .toString(10)
1729
+ )
1730
+ .setAdvanced(true)
1731
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden);
1732
+
1733
+ behaviorProperties
1734
+ .getOrCreate('shouldBindObjectAndForwardAngle')
1735
+ .setLabel('Keep object angle and forward direction the same')
1736
+ .setGroup(_('Walk'))
1737
+ .setType('Boolean')
1738
+ .setValue(
1739
+ behaviorContent
1740
+ .getChild('shouldBindObjectAndForwardAngle')
1741
+ .getBoolValue()
1742
+ ? 'true'
1743
+ : 'false'
1744
+ )
1745
+ .setAdvanced(true)
1746
+ .setQuickCustomizationVisibility(gd.QuickCustomization.Hidden);
1747
+
1748
+ return behaviorProperties;
1749
+ };
1750
+
1751
+ behavior.initializeContent = function (behaviorContent) {
1752
+ behaviorContent.addChild('physics3D').setStringValue('');
1753
+ behaviorContent.addChild('jumpHeight').setDoubleValue(200);
1754
+ behaviorContent.addChild('jumpSustainTime').setDoubleValue(0.2);
1755
+ behaviorContent.addChild('gravity').setDoubleValue(1000);
1756
+ behaviorContent.addChild('fallingSpeedMax').setDoubleValue(700);
1757
+ behaviorContent.addChild('forwardAcceleration').setDoubleValue(1200);
1758
+ behaviorContent.addChild('forwardDeceleration').setDoubleValue(1200);
1759
+ behaviorContent.addChild('forwardSpeedMax').setDoubleValue(600);
1760
+ behaviorContent.addChild('sidewaysAcceleration').setDoubleValue(800);
1761
+ behaviorContent.addChild('sidewaysDeceleration').setDoubleValue(800);
1762
+ behaviorContent.addChild('sidewaysSpeedMax').setDoubleValue(400);
1763
+ behaviorContent.addChild('slopeMaxAngle').setDoubleValue(50);
1764
+ behaviorContent.addChild('stairHeightMax').setDoubleValue(20);
1765
+ behaviorContent
1766
+ .addChild('shouldBindObjectAndForwardAngle')
1767
+ .setBoolValue(true);
1768
+ };
1769
+
1770
+ const aut = extension
1771
+ .addBehavior(
1772
+ 'PhysicsCharacter3D',
1773
+ _('3D physics character'),
1774
+ 'PhysicsCharacter3D',
1775
+ _('Jump and run on platforms.'),
1776
+ '',
1777
+ 'JsPlatform/Extensions/physics_character3d.svg',
1778
+ 'PhysicsCharacter3D',
1779
+ //@ts-ignore The class hierarchy is incorrect leading to a type error, but this is valid.
1780
+ behavior,
1781
+ new gd.BehaviorsSharedData()
1782
+ )
1783
+ .addIncludeFile(
1784
+ 'Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js'
1785
+ );
1786
+
1787
+ aut
1788
+ .addScopedAction(
1789
+ 'SimulateForwardKey',
1790
+ _('Simulate move forward key press'),
1791
+ _('Simulate a press of the move forward key.'),
1792
+ _('Simulate pressing Forward key for _PARAM0_'),
1793
+ _('Character controls'),
1794
+ 'JsPlatform/Extensions/physics_character3d.svg',
1795
+ 'JsPlatform/Extensions/physics_character3d.svg'
1796
+ )
1797
+ .addParameter('object', _('Object'), '', false)
1798
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
1799
+ .setFunctionName('simulateForwardKey');
1800
+
1801
+ aut
1802
+ .addScopedAction(
1803
+ 'SimulateBackwardKey',
1804
+ _('Simulate move backward key press'),
1805
+ _('Simulate a press of the move backward key.'),
1806
+ _('Simulate pressing Backward key for _PARAM0_'),
1807
+ _('Character controls'),
1808
+ 'JsPlatform/Extensions/physics_character3d.svg',
1809
+ 'JsPlatform/Extensions/physics_character3d.svg'
1810
+ )
1811
+ .addParameter('object', _('Object'), '', false)
1812
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
1813
+ .setFunctionName('simulateBackwardKey');
1814
+
1815
+ aut
1816
+ .addScopedAction(
1817
+ 'SimulateRightKey',
1818
+ _('Simulate move right key press'),
1819
+ _('Simulate a press of the move right key.'),
1820
+ _('Simulate pressing Right key for _PARAM0_'),
1821
+ _('Character controls'),
1822
+ 'JsPlatform/Extensions/physics_character3d.svg',
1823
+ 'JsPlatform/Extensions/physics_character3d.svg'
1824
+ )
1825
+ .addParameter('object', _('Object'), '', false)
1826
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
1827
+ .setFunctionName('simulateRightKey');
1828
+
1829
+ aut
1830
+ .addScopedAction(
1831
+ 'SimulateLeftKey',
1832
+ _('Simulate move left key press'),
1833
+ _('Simulate a press of the move left key.'),
1834
+ _('Simulate pressing Left key for _PARAM0_'),
1835
+ _('Character controls'),
1836
+ 'JsPlatform/Extensions/physics_character3d.svg',
1837
+ 'JsPlatform/Extensions/physics_character3d.svg'
1838
+ )
1839
+ .addParameter('object', _('Object'), '', false)
1840
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
1841
+ .setFunctionName('simulateLeftKey');
1842
+
1843
+ aut
1844
+ .addScopedAction(
1845
+ 'SimulateJumpKey',
1846
+ _('Simulate jump key press'),
1847
+ _('Simulate a press of the jump key.'),
1848
+ _('Simulate pressing Jump key for _PARAM0_'),
1849
+ _('Character controls'),
1850
+ 'JsPlatform/Extensions/physics_character3d.svg',
1851
+ 'JsPlatform/Extensions/physics_character3d.svg'
1852
+ )
1853
+ .addParameter('object', _('Object'), '', false)
1854
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
1855
+ .setFunctionName('simulateJumpKey');
1856
+
1857
+ aut
1858
+ .addScopedAction(
1859
+ 'SimulateStick',
1860
+ _('Simulate stick control'),
1861
+ _('Simulate a stick control.'),
1862
+ _(
1863
+ 'Simulate a stick control for _PARAM0_ with a _PARAM2_ angle and a _PARAM3_ force'
1864
+ ),
1865
+ _('Character controls'),
1866
+ 'JsPlatform/Extensions/physics_character3d.svg',
1867
+ 'JsPlatform/Extensions/physics_character3d.svg'
1868
+ )
1869
+ .addParameter('object', _('Object'), '', false)
1870
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
1871
+ .addParameter('expression', _('Stick angle (in degrees)'))
1872
+ .addParameter('expression', _('Stick force (between 0 and 1)'))
1873
+ .markAsAdvanced()
1874
+ .setFunctionName('simulateStick');
1875
+
1876
+ aut
1877
+ .addScopedAction(
1878
+ 'SetCanJump',
1879
+ _('Allow jumping again'),
1880
+ _(
1881
+ "When this action is executed, the object is able to jump again, even if it is in the air: this can be useful to allow a double jump for example. This is not a permanent effect: you must call again this action every time you want to allow the object to jump (apart if it's on the floor)."
1882
+ ),
1883
+ _('Allow _PARAM0_ to jump again'),
1884
+ _('Character state'),
1885
+ 'JsPlatform/Extensions/physics_character3d.svg',
1886
+ 'JsPlatform/Extensions/physics_character3d.svg'
1887
+ )
1888
+ .addParameter('object', _('Object'), '', false)
1889
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
1890
+ .markAsSimple()
1891
+ .setFunctionName('setCanJump');
1892
+
1893
+ aut
1894
+ .addScopedAction(
1895
+ 'SetCanNotAirJump',
1896
+ _('Forbid jumping again in the air'),
1897
+ _(
1898
+ 'This revokes the effect of "Allow jumping again". The object is made unable to jump while in mid air. This has no effect if the object is not in the air.'
1899
+ ),
1900
+ _('Forbid _PARAM0_ to air jump'),
1901
+ _('Character state'),
1902
+ 'JsPlatform/Extensions/physics_character3d.svg',
1903
+ 'JsPlatform/Extensions/physics_character3d.svg'
1904
+ )
1905
+ .addParameter('object', _('Object'), '', false)
1906
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
1907
+ .setFunctionName('setCanNotAirJump');
1908
+
1909
+ aut
1910
+ .addScopedAction(
1911
+ 'AbortJump',
1912
+ _('Abort jump'),
1913
+ _(
1914
+ "Abort the current jump and stop the object vertically. This action doesn't have any effect when the character is not jumping."
1915
+ ),
1916
+ _('Abort the current jump of _PARAM0_'),
1917
+ _('Character state'),
1918
+ 'JsPlatform/Extensions/physics_character3d.svg',
1919
+ 'JsPlatform/Extensions/physics_character3d.svg'
1920
+ )
1921
+ .addParameter('object', _('Object'), '', false)
1922
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
1923
+ .setFunctionName('abortJump');
1924
+
1925
+ aut
1926
+ .addScopedCondition(
1927
+ 'CanJump',
1928
+ _('Can jump'),
1929
+ _('Check if the object can jump.'),
1930
+ _('_PARAM0_ can jump'),
1931
+ _('Character state'),
1932
+ 'JsPlatform/Extensions/physics_character3d.svg',
1933
+ 'JsPlatform/Extensions/physics_character3d.svg'
1934
+ )
1935
+ .addParameter('object', _('Object'), '', false)
1936
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
1937
+ .markAsSimple()
1938
+ .setFunctionName('canJump');
1939
+
1940
+ aut
1941
+ .addScopedCondition(
1942
+ 'IsMovingEvenALittle',
1943
+ _('Is moving'),
1944
+ _(
1945
+ 'Check if the object is moving (whether it is on the floor or in the air).'
1946
+ ),
1947
+ _('_PARAM0_ is moving'),
1948
+ _('Character state'),
1949
+ 'JsPlatform/Extensions/physics_character3d.svg',
1950
+ 'JsPlatform/Extensions/physics_character3d.svg'
1951
+ )
1952
+ .addParameter('object', _('Object'), '', false)
1953
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
1954
+ .markAsSimple()
1955
+ .setFunctionName('isMovingEvenALittle');
1956
+
1957
+ aut
1958
+ .addScopedCondition(
1959
+ 'IsOnFloor',
1960
+ _('Is on floor'),
1961
+ _('Check if the object is on a platform.'),
1962
+ _('_PARAM0_ is on floor'),
1963
+ _('Character state'),
1964
+ 'JsPlatform/Extensions/physics_character3d.svg',
1965
+ 'JsPlatform/Extensions/physics_character3d.svg'
1966
+ )
1967
+ .addParameter('object', _('Object'), '', false)
1968
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
1969
+ .markAsSimple()
1970
+ .setFunctionName('isOnFloor');
1971
+
1972
+ aut
1973
+ .addScopedCondition(
1974
+ 'IsJumping',
1975
+ _('Is jumping'),
1976
+ _('Check if the object is jumping.'),
1977
+ _('_PARAM0_ is jumping'),
1978
+ _('Character state'),
1979
+ 'JsPlatform/Extensions/physics_character3d.svg',
1980
+ 'JsPlatform/Extensions/physics_character3d.svg'
1981
+ )
1982
+ .addParameter('object', _('Object'), '', false)
1983
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
1984
+ .markAsSimple()
1985
+ .setFunctionName('isJumping');
1986
+
1987
+ aut
1988
+ .addScopedCondition(
1989
+ 'IsFalling',
1990
+ _('Is falling'),
1991
+ _(
1992
+ 'Check if the object is falling.\nNote that the object can be flagged as jumping and falling at the same time: at the end of a jump, the fall speed becomes higher than the jump speed.'
1993
+ ),
1994
+ _('_PARAM0_ is falling'),
1995
+ _('Character state'),
1996
+ 'JsPlatform/Extensions/physics_character3d.svg',
1997
+ 'JsPlatform/Extensions/physics_character3d.svg'
1998
+ )
1999
+ .addParameter('object', _('Object'), '', false)
2000
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2001
+ .setFunctionName('isFalling');
2002
+
2003
+ aut
2004
+ .addScopedCondition(
2005
+ 'ShouldBindObjectAndForwardAngle',
2006
+ _('Should bind object and forward angle'),
2007
+ _(
2008
+ 'Check if the object angle and forward angle should be kept the same.'
2009
+ ),
2010
+ _('Keep _PARAM0_ angle and forward angle the same'),
2011
+ _('Character configuration'),
2012
+ 'JsPlatform/Extensions/physics_character3d.svg',
2013
+ 'JsPlatform/Extensions/physics_character3d.svg'
2014
+ )
2015
+ .addParameter('object', _('Object'), '', false)
2016
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2017
+ .getCodeExtraInformation()
2018
+ .setFunctionName('shouldBindObjectAndForwardAngle');
2019
+
2020
+ aut
2021
+ .addScopedAction(
2022
+ 'SetShouldBindObjectAndForwardAngle',
2023
+ _('Should bind object and forward angle'),
2024
+ _(
2025
+ 'Enable or disable keeping the object angle and forward angle the same.'
2026
+ ),
2027
+ _('Should bind _PARAM0_ angle and forward angle: _PARAM2_'),
2028
+ _('Character configuration'),
2029
+ 'JsPlatform/Extensions/physics_character3d.svg',
2030
+ 'JsPlatform/Extensions/physics_character3d.svg'
2031
+ )
2032
+ .addParameter('object', _('Object'), '', false)
2033
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2034
+ .addParameter(
2035
+ 'yesorno',
2036
+ _('Keep object angle and forward direction the same'),
2037
+ '',
2038
+ false
2039
+ )
2040
+ .setDefaultValue('false')
2041
+ .getCodeExtraInformation()
2042
+ .setFunctionName('setShouldBindObjectAndForwardAngle');
2043
+
2044
+ aut
2045
+ .addScopedCondition(
2046
+ 'IsForwardAngleAround',
2047
+ _('Forward angle'),
2048
+ _('Compare the angle used by the character to go forward.'),
2049
+ _('Forward angle of _PARAM0_ is _PARAM2_ ± _PARAM3_°'),
2050
+ _('Character state'),
2051
+ 'JsPlatform/Extensions/physics_character3d.svg',
2052
+ 'JsPlatform/Extensions/physics_character3d.svg'
2053
+ )
2054
+ .addParameter('object', _('Object'), '', false)
2055
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2056
+ .addParameter('expression', _('Angle (in degrees)'))
2057
+ .addParameter('expression', _('Tolerance (in degrees)'))
2058
+ .setFunctionName('isForwardAngleAround');
2059
+
2060
+ aut
2061
+ .addScopedAction(
2062
+ 'SetForwardAngle',
2063
+ _('Forward angle'),
2064
+ _('Change the angle used by the character to go forward.'),
2065
+ _('the forward angle'),
2066
+ _('Character state'),
2067
+ 'JsPlatform/Extensions/physics_character3d.svg',
2068
+ 'JsPlatform/Extensions/physics_character3d.svg'
2069
+ )
2070
+ .addParameter('object', _('Object'), '', false)
2071
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2072
+ .useStandardOperatorParameters(
2073
+ 'number',
2074
+ gd.ParameterOptions.makeNewOptions().setDescription(
2075
+ _('Angle (in degrees)')
2076
+ )
2077
+ )
2078
+ .setFunctionName('setForwardAngle')
2079
+ .setGetter('getForwardAngle');
2080
+
2081
+ aut
2082
+ .addExpression(
2083
+ 'ForwardAngle',
2084
+ _('Forward angle of the character'),
2085
+ _('Return the angle used by the character to go forward.'),
2086
+ _('Character state'),
2087
+ 'JsPlatform/Extensions/physics_character3d.svg'
2088
+ )
2089
+ .addParameter('object', _('Object'), '', false)
2090
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2091
+ .setFunctionName('getForwardAngle');
2092
+
2093
+ aut
2094
+ .addExpressionAndConditionAndAction(
2095
+ 'number',
2096
+ 'CurrentForwardSpeed',
2097
+ _('Current forward speed'),
2098
+ _(
2099
+ 'the current forward speed of the object. The object moves backward with negative values and forward with positive ones'
2100
+ ),
2101
+ _('the current forward speed'),
2102
+ _('Character state'),
2103
+ 'JsPlatform/Extensions/physics_character3d.svg'
2104
+ )
2105
+ .addParameter('object', _('Object'), '', false)
2106
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2107
+ .useStandardParameters(
2108
+ 'number',
2109
+ gd.ParameterOptions.makeNewOptions().setDescription(
2110
+ _('Speed (in pixels per second)')
2111
+ )
2112
+ )
2113
+ .setFunctionName('setCurrentForwardSpeed')
2114
+ .setGetter('getCurrentForwardSpeed');
2115
+
2116
+ aut
2117
+ .addExpressionAndConditionAndAction(
2118
+ 'number',
2119
+ 'ForwardAcceleration',
2120
+ _('Forward acceleration'),
2121
+ _('the forward acceleration of an object.'),
2122
+ _('the forward acceleration'),
2123
+ _('Character configuration'),
2124
+ 'JsPlatform/Extensions/physics_character3d.svg'
2125
+ )
2126
+ .addParameter('object', _('Object'), '', false)
2127
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2128
+ .useStandardParameters(
2129
+ 'number',
2130
+ gd.ParameterOptions.makeNewOptions().setDescription(
2131
+ _('Acceleration (in pixels per second per second)')
2132
+ )
2133
+ )
2134
+ .markAsAdvanced()
2135
+ .setFunctionName('setForwardAcceleration')
2136
+ .setGetter('getForwardAcceleration');
2137
+
2138
+ aut
2139
+ .addExpressionAndConditionAndAction(
2140
+ 'number',
2141
+ 'ForwardDeceleration',
2142
+ _('Forward deceleration'),
2143
+ _('the forward deceleration of an object.'),
2144
+ _('the forward deceleration'),
2145
+ _('Character configuration'),
2146
+ 'JsPlatform/Extensions/physics_character3d.svg'
2147
+ )
2148
+ .addParameter('object', _('Object'), '', false)
2149
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2150
+ .useStandardParameters(
2151
+ 'number',
2152
+ gd.ParameterOptions.makeNewOptions().setDescription(
2153
+ _('Deceleration (in pixels per second per second)')
2154
+ )
2155
+ )
2156
+ .markAsAdvanced()
2157
+ .setFunctionName('setForwardDeceleration')
2158
+ .setGetter('getForwardDeceleration');
2159
+
2160
+ aut
2161
+ .addExpressionAndConditionAndAction(
2162
+ 'number',
2163
+ 'ForwardSpeedMax',
2164
+ _('Forward max speed'),
2165
+ _('the forward max speed of the object.'),
2166
+ _('the forward max speed'),
2167
+ _('Character configuration'),
2168
+ 'JsPlatform/Extensions/physics_character3d.svg'
2169
+ )
2170
+ .addParameter('object', _('Object'), '', false)
2171
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2172
+ .useStandardParameters(
2173
+ 'number',
2174
+ gd.ParameterOptions.makeNewOptions().setDescription(
2175
+ _('Speed (in pixels per second)')
2176
+ )
2177
+ )
2178
+ .setFunctionName('setForwardSpeedMax')
2179
+ .setGetter('getForwardSpeedMax');
2180
+
2181
+ aut
2182
+ .addExpressionAndConditionAndAction(
2183
+ 'number',
2184
+ 'CurrentSidewaysSpeed',
2185
+ _('Current sideways speed'),
2186
+ _(
2187
+ 'the current sideways speed of the object. The object moves to the left with negative values and to the right with positive ones'
2188
+ ),
2189
+ _('the current sideways speed'),
2190
+ _('Character state'),
2191
+ 'JsPlatform/Extensions/physics_character3d.svg'
2192
+ )
2193
+ .addParameter('object', _('Object'), '', false)
2194
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2195
+ .useStandardParameters(
2196
+ 'number',
2197
+ gd.ParameterOptions.makeNewOptions().setDescription(
2198
+ _('Speed (in pixels per second)')
2199
+ )
2200
+ )
2201
+ .setFunctionName('setCurrentSidewaysSpeed')
2202
+ .setGetter('getCurrentSidewaysSpeed');
2203
+
2204
+ aut
2205
+ .addExpressionAndConditionAndAction(
2206
+ 'number',
2207
+ 'SidewaysAcceleration',
2208
+ _('Sideways acceleration'),
2209
+ _('the sideways acceleration of an object.'),
2210
+ _('the sideways acceleration'),
2211
+ _('Character configuration'),
2212
+ 'JsPlatform/Extensions/physics_character3d.svg'
2213
+ )
2214
+ .addParameter('object', _('Object'), '', false)
2215
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2216
+ .useStandardParameters(
2217
+ 'number',
2218
+ gd.ParameterOptions.makeNewOptions().setDescription(
2219
+ _('Acceleration (in pixels per second per second)')
2220
+ )
2221
+ )
2222
+ .markAsAdvanced()
2223
+ .setFunctionName('setSidewaysAcceleration')
2224
+ .setGetter('getSidewaysAcceleration');
2225
+
2226
+ aut
2227
+ .addExpressionAndConditionAndAction(
2228
+ 'number',
2229
+ 'SidewaysDeceleration',
2230
+ _('Sideways deceleration'),
2231
+ _('the sideways deceleration of an object.'),
2232
+ _('the sideways deceleration'),
2233
+ _('Character configuration'),
2234
+ 'JsPlatform/Extensions/physics_character3d.svg'
2235
+ )
2236
+ .addParameter('object', _('Object'), '', false)
2237
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2238
+ .useStandardParameters(
2239
+ 'number',
2240
+ gd.ParameterOptions.makeNewOptions().setDescription(
2241
+ _('Deceleration (in pixels per second per second)')
2242
+ )
2243
+ )
2244
+ .markAsAdvanced()
2245
+ .setFunctionName('setSidewaysDeceleration')
2246
+ .setGetter('getSidewaysDeceleration');
2247
+
2248
+ aut
2249
+ .addExpressionAndConditionAndAction(
2250
+ 'number',
2251
+ 'SidewaysSpeedMax',
2252
+ _('Sideways max speed'),
2253
+ _('the sideways max speed of the object.'),
2254
+ _('the sideways max speed'),
2255
+ _('Character configuration'),
2256
+ 'JsPlatform/Extensions/physics_character3d.svg'
2257
+ )
2258
+ .addParameter('object', _('Object'), '', false)
2259
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2260
+ .useStandardParameters(
2261
+ 'number',
2262
+ gd.ParameterOptions.makeNewOptions().setDescription(
2263
+ _('Speed (in pixels per second)')
2264
+ )
2265
+ )
2266
+ .setFunctionName('setSidewaysSpeedMax')
2267
+ .setGetter('getSidewaysSpeedMax');
2268
+
2269
+ aut
2270
+ .addExpressionAndConditionAndAction(
2271
+ 'number',
2272
+ 'CurrentFallSpeed',
2273
+ _('Current falling speed'),
2274
+ _(
2275
+ 'Compare the current falling speed of the object. Its value is always positive.'
2276
+ ),
2277
+ _('the current falling speed'),
2278
+ _('Character state'),
2279
+ 'JsPlatform/Extensions/physics_character3d.svg'
2280
+ )
2281
+ .addParameter('object', _('Object'), '', false)
2282
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2283
+ .useStandardParameters(
2284
+ 'number',
2285
+ gd.ParameterOptions.makeNewOptions().setDescription(
2286
+ _('Speed to compare to (in pixels per second)')
2287
+ )
2288
+ )
2289
+ .markAsAdvanced()
2290
+ .setFunctionName('setCurrentFallSpeed')
2291
+ .setGetter('getCurrentFallSpeed');
2292
+
2293
+ aut
2294
+ .addExpressionAndConditionAndAction(
2295
+ 'number',
2296
+ 'CurrentJumpSpeed',
2297
+ _('Current jump speed'),
2298
+ _(
2299
+ 'Compare the current jump speed of the object. Its value is always positive.'
2300
+ ),
2301
+ _('the current jump speed'),
2302
+ _('Character state'),
2303
+ 'JsPlatform/Extensions/physics_character3d.svg'
2304
+ )
2305
+ .addParameter('object', _('Object'), '', false)
2306
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2307
+ .useStandardParameters(
2308
+ 'number',
2309
+ gd.ParameterOptions.makeNewOptions().setDescription(
2310
+ _('Speed to compare to (in pixels per second)')
2311
+ )
2312
+ )
2313
+ .markAsAdvanced()
2314
+ .setFunctionName('setCurrentJumpSpeed')
2315
+ .setGetter('getCurrentJumpSpeed');
2316
+
2317
+ aut
2318
+ .addExpressionAndConditionAndAction(
2319
+ 'number',
2320
+ 'JumpSpeed',
2321
+ _('Jump speed'),
2322
+ _('the jump speed of an object. Its value is always positive.'),
2323
+ _('the jump speed'),
2324
+ _('Character configuration'),
2325
+ 'JsPlatform/Extensions/physics_character3d.svg'
2326
+ )
2327
+ .addParameter('object', _('Object'), '', false)
2328
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2329
+ .useStandardParameters(
2330
+ 'number',
2331
+ gd.ParameterOptions.makeNewOptions().setDescription(
2332
+ _('Speed (in pixels per second)')
2333
+ )
2334
+ )
2335
+ .setFunctionName('setJumpSpeed')
2336
+ .setGetter('getJumpSpeed');
2337
+
2338
+ aut
2339
+ .addExpressionAndConditionAndAction(
2340
+ 'number',
2341
+ 'JumpSustainTime',
2342
+ _('Jump sustain time'),
2343
+ _(
2344
+ 'the jump sustain time of an object. This is the time during which keeping the jump button held allow the initial jump speed to be maintained.'
2345
+ ),
2346
+ _('the jump sustain time'),
2347
+ _('Character configuration'),
2348
+ 'JsPlatform/Extensions/physics_character3d.svg'
2349
+ )
2350
+ .addParameter('object', _('Object'), '', false)
2351
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2352
+ .useStandardParameters(
2353
+ 'number',
2354
+ gd.ParameterOptions.makeNewOptions().setDescription(
2355
+ _('Duration (in seconds)')
2356
+ )
2357
+ )
2358
+ .setFunctionName('setJumpSustainTime')
2359
+ .setGetter('getJumpSustainTime');
2360
+
2361
+ aut
2362
+ .addExpressionAndConditionAndAction(
2363
+ 'number',
2364
+ 'Gravity',
2365
+ _('Gravity'),
2366
+ _('the gravity applied on an object.'),
2367
+ _('the gravity'),
2368
+ _('Character configuration'),
2369
+ 'JsPlatform/Extensions/physics_character3d.svg'
2370
+ )
2371
+ .addParameter('object', _('Object'), '', false)
2372
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2373
+ .useStandardParameters(
2374
+ 'number',
2375
+ gd.ParameterOptions.makeNewOptions().setDescription(
2376
+ _('Gravity (in pixels per second per second)')
2377
+ )
2378
+ )
2379
+ .markAsAdvanced()
2380
+ .setFunctionName('setGravity')
2381
+ .setGetter('getGravity');
2382
+
2383
+ aut
2384
+ .addExpressionAndCondition(
2385
+ 'number',
2386
+ 'FallingSpeedMax',
2387
+ _('Maximum falling speed'),
2388
+ _('the maximum falling speed of an object.'),
2389
+ _('the maximum falling speed'),
2390
+ _('Character configuration'),
2391
+ 'JsPlatform/Extensions/physics_character3d.svg'
2392
+ )
2393
+ .addParameter('object', _('Object'), '', false)
2394
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2395
+ .useStandardParameters(
2396
+ 'number',
2397
+ gd.ParameterOptions.makeNewOptions().setDescription(
2398
+ _('Max speed (in pixels per second)')
2399
+ )
2400
+ )
2401
+ .markAsAdvanced()
2402
+ .setFunctionName('getMaxFallingSpeed');
2403
+
2404
+ aut
2405
+ .addScopedAction(
2406
+ 'FallingSpeedMax',
2407
+ _('Maximum falling speed'),
2408
+ _('Change the maximum falling speed of an object.'),
2409
+ _('the maximum falling speed'),
2410
+ _('Character configuration'),
2411
+ 'JsPlatform/Extensions/physics_character3d.svg',
2412
+ 'JsPlatform/Extensions/physics_character3d.svg'
2413
+ )
2414
+ .addParameter('object', _('Object'), '', false)
2415
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2416
+ .useStandardOperatorParameters(
2417
+ 'number',
2418
+ gd.ParameterOptions.makeNewOptions().setDescription(
2419
+ _('Max speed (in pixels per second)')
2420
+ )
2421
+ )
2422
+ .addParameter(
2423
+ 'yesorno',
2424
+ _('If jumping, try to preserve the current speed in the air')
2425
+ )
2426
+ .markAsAdvanced()
2427
+ .setFunctionName('setMaxFallingSpeed')
2428
+ .setGetter('getMaxFallingSpeed');
2429
+ }
2430
+
2431
+ extension
2432
+ .addCondition(
2433
+ 'IsObjectOnGivenFloor',
2434
+ _('Character is on given platform'),
2435
+ _('Check if a 3D physics character is on a given platform.'),
2436
+ _('_PARAM0_ is on platform _PARAM2_'),
2437
+ _('Collision'),
2438
+ 'JsPlatform/Extensions/physics_character3d.svg',
2439
+ 'JsPlatform/Extensions/physics_character3d.svg'
2440
+ )
2441
+ .addParameter('objectList', _('Object'), '', false)
2442
+ .addParameter('behavior', _('Behavior'), 'PhysicsCharacter3D')
2443
+ .addParameter('objectList', _('Platforms'), '', false)
2444
+ .addParameter('behavior', _('Behavior'), 'Physics3DBehavior')
2445
+ .addCodeOnlyParameter('conditionInverted', '')
2446
+ .setFunctionName('gdjs.physics3d.isOnPlatform')
2447
+ .addIncludeFile('Extensions/Physics3DBehavior/Physics3DTools.js');
2448
+
2449
+ return extension;
2450
+ },
2451
+
2452
+ runExtensionSanityTests: function (gd, extension) {
2453
+ const dummyBehavior = extension
2454
+ .getBehaviorMetadata('Physics3D::Physics3DBehavior')
2455
+ .get();
2456
+ const sharedData = extension
2457
+ .getBehaviorMetadata('Physics3D::Physics3DBehavior')
2458
+ .getSharedDataInstance();
2459
+ return [
2460
+ gd.ProjectHelper.sanityCheckBehaviorProperty(
2461
+ dummyBehavior,
2462
+ 'density',
2463
+ '123'
2464
+ ),
2465
+ gd.ProjectHelper.sanityCheckBehaviorsSharedDataProperty(
2466
+ sharedData,
2467
+ 'gravityY',
2468
+ '456'
2469
+ ),
2470
+ ];
2471
+ },
2472
+ };