Skip to content

Commit ec1fa58

Browse files
authored
[Community] [Joint connector] Fix missing behavior parameters (#1636)
1 parent b76ba01 commit ec1fa58

1 file changed

Lines changed: 52 additions & 30 deletions

File tree

extensions/community/JointConnector.json

Lines changed: 52 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"author": "",
33
"category": "Movement",
44
"extensionNamespace": "",
5+
"fullName": "Joint connector",
56
"gdevelopVersion": ">=5.5.222",
6-
"fullName": "Joint Connector",
77
"helpPath": "",
88
"iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWh1bWFuIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTIxLDlIMTVWMjJIMTNWMTZIMTFWMjJIOVY5SDNWN0gyMU0xMiwyQTIsMiAwIDAsMSAxNCw0QTIsMiAwIDAsMSAxMiw2QzEwLjg5LDYgMTAsNS4xIDEwLDRDMTAsMi44OSAxMC44OSwyIDEyLDJaIiAvPjwvc3ZnPg==",
99
"name": "JointConnector",
1010
"previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/8834e0c63a962c74f1dab4c8f918c171261597341c4ca6574b300ab35855274b_human.svg",
1111
"shortDescription": "Create and manage physics joints between two objects.",
12-
"version": "1.1.0",
12+
"version": "1.2.0",
1313
"description": [
1414
"Weld joint",
1515
"- Glue two objects together",
@@ -29,6 +29,10 @@
2929
"- Two objects can get closer to each other but they cannot exceed their starting distance",
3030
"- Center of both objects must be inside the Joint Connector collision mask"
3131
],
32+
"origin": {
33+
"identifier": "JointConnector",
34+
"name": "gdevelop-extension-store"
35+
},
3236
"tags": [
3337
"joint",
3438
"ragdoll",
@@ -45,6 +49,8 @@
4549
"rotBq28wITdtfsrE7McHQri4k2w2"
4650
],
4751
"dependencies": [],
52+
"globalVariables": [],
53+
"sceneVariables": [],
4854
"eventsFunctions": [
4955
{
5056
"description": "Connect overlapping physics objects with a revolute joint.",
@@ -56,13 +62,15 @@
5662
{
5763
"type": "BuiltinCommonInstructions::JsCode",
5864
"inlineCode": [
59-
"const behaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");",
65+
"",
66+
"const physicsBehaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");",
6067
"const jointObjects = eventsFunctionContext.getObjects(\"Joint\");",
68+
"const jointBehaviorBehaviorName = eventsFunctionContext.getBehaviorName(\"RevoluteJoint\");",
6169
"const linkManager = gdjs.LinksManager.getManager(runtimeScene);",
6270
"",
6371
"for (const jointObject of jointObjects) {",
6472
" // Save properties of each joint",
65-
" const jointBehavior = jointObject.getBehavior(\"RevoluteJoint\");",
73+
" const jointBehavior = jointObject.getBehavior(jointBehaviorBehaviorName);",
6674
" const enableLimit = jointBehavior._getAngleLimitsEnabled();",
6775
" const lowerAngle = jointBehavior._getCounterClockwiseAngleLimit();",
6876
" const upperAngle = jointBehavior._getClockwiseAngleLimit();",
@@ -85,7 +93,7 @@
8593
" }",
8694
" else {",
8795
" /** @type {gdjs.Physics2RuntimeBehavior} */",
88-
" const physicsBehavior = firstObject.getBehavior(behaviorName);",
96+
" const physicsBehavior = firstObject.getBehavior(physicsBehaviorName);",
8997
" const referenceAngle = object.angle - firstObject.angle;",
9098
" physicsBehavior.addRevoluteJointBetweenTwoBodies(",
9199
" x,",
@@ -131,6 +139,12 @@
131139
"description": "Joint connector (center of this object is used to create the joint)",
132140
"name": "Joint",
133141
"type": "objectList"
142+
},
143+
{
144+
"description": "Revolute joint connector",
145+
"name": "RevoluteJoint",
146+
"supplementaryInformation": "JointConnector::RevoluteJoint",
147+
"type": "behavior"
134148
}
135149
],
136150
"objectGroups": []
@@ -145,13 +159,15 @@
145159
{
146160
"type": "BuiltinCommonInstructions::JsCode",
147161
"inlineCode": [
148-
"const behaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");",
162+
"",
163+
"const physicsBehaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");",
149164
"const jointObjects = eventsFunctionContext.getObjects(\"Joint\");",
165+
"const jointBehaviorBehaviorName = eventsFunctionContext.getBehaviorName(\"WeldJoint\");",
150166
"const linkManager = gdjs.LinksManager.getManager(runtimeScene);",
151167
"",
152168
"for (const jointObject of jointObjects) {",
153169
" // Save properties of each joint",
154-
" const jointBehavior = jointObject.getBehavior(\"WeldJoint\");",
170+
" const jointBehavior = jointObject.getBehavior(jointBehaviorBehaviorName);",
155171
" const frequency = jointBehavior._getFrequency();",
156172
" const dampingRatio = jointBehavior._getDampingRatio();",
157173
" const collideConnected = false;",
@@ -170,7 +186,7 @@
170186
" }",
171187
" else {",
172188
" /** @type {gdjs.Physics2RuntimeBehavior} */",
173-
" const physicsBehavior = firstObject.getBehavior(behaviorName);",
189+
" const physicsBehavior = firstObject.getBehavior(physicsBehaviorName);",
174190
" const referenceAngle = object.angle - firstObject.angle;",
175191
" const frequency = 30;",
176192
" const dampingRatio = 1;",
@@ -214,6 +230,12 @@
214230
"description": "Joint connector (center of this object is used to create the joint)",
215231
"name": "Joint",
216232
"type": "objectList"
233+
},
234+
{
235+
"description": "Weld joint connector",
236+
"name": "RevoluteJoint",
237+
"supplementaryInformation": "JointConnector::WeldJoint",
238+
"type": "behavior"
217239
}
218240
],
219241
"objectGroups": []
@@ -228,13 +250,15 @@
228250
{
229251
"type": "BuiltinCommonInstructions::JsCode",
230252
"inlineCode": [
231-
"const behaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");",
253+
"",
254+
"const physicsBehaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");",
232255
"const jointObjects = eventsFunctionContext.getObjects(\"Joint\");",
256+
"const jointBehaviorBehaviorName = eventsFunctionContext.getBehaviorName(\"DistanceJoint\");",
233257
"const linkManager = gdjs.LinksManager.getManager(runtimeScene);",
234258
"",
235259
"for (const jointObject of jointObjects) {",
236260
" // Save properties of each joint",
237-
" const jointBehavior = jointObject.getBehavior(\"DistanceJoint\");",
261+
" const jointBehavior = jointObject.getBehavior(jointBehaviorBehaviorName);",
238262
" const length = jointBehavior._getDistance();",
239263
" const frequency = jointBehavior._getFrequency();",
240264
" const dampingRatio = jointBehavior._getDampingRatio();",
@@ -256,7 +280,7 @@
256280
" var y2 = object.getAABBCenterY();",
257281
" if (jointObject.isCollidingWithPoint(x2, y2)) {",
258282
" /** @type {gdjs.Physics2RuntimeBehavior} */",
259-
" const physicsBehavior = firstObject.getBehavior(behaviorName);",
283+
" const physicsBehavior = firstObject.getBehavior(physicsBehaviorName);",
260284
" physicsBehavior.addDistanceJoint(",
261285
" x1,",
262286
" y1,",
@@ -297,6 +321,12 @@
297321
"description": "Joint connector (center of this object is used to create the joint)",
298322
"name": "Joint",
299323
"type": "objectList"
324+
},
325+
{
326+
"description": "Distance joint connector",
327+
"name": "RevoluteJoint",
328+
"supplementaryInformation": "JointConnector::DistanceJoint",
329+
"type": "behavior"
300330
}
301331
],
302332
"objectGroups": []
@@ -311,13 +341,15 @@
311341
{
312342
"type": "BuiltinCommonInstructions::JsCode",
313343
"inlineCode": [
314-
"const behaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");",
344+
"",
345+
"const physicsBehaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");",
315346
"const jointObjects = eventsFunctionContext.getObjects(\"Joint\");",
347+
"const jointBehaviorBehaviorName = eventsFunctionContext.getBehaviorName(\"RopeJoint\");",
316348
"const linkManager = gdjs.LinksManager.getManager(runtimeScene);",
317349
"",
318350
"for (const jointObject of jointObjects) {",
319351
" // Save properties of each joint",
320-
" const jointBehavior = jointObject.getBehavior(\"RopeJoint\");",
352+
" const jointBehavior = jointObject.getBehavior(jointBehaviorBehaviorName);",
321353
" const maxlength = jointBehavior._getMaxDistance();",
322354
" const collideConnected = false;",
323355
"",
@@ -337,7 +369,7 @@
337369
" var y2 = object.getAABBCenterY();",
338370
" if (jointObject.isCollidingWithPoint(x2, y2)) {",
339371
" /** @type {gdjs.Physics2RuntimeBehavior} */",
340-
" const physicsBehavior = firstObject.getBehavior(behaviorName);",
372+
" const physicsBehavior = firstObject.getBehavior(physicsBehaviorName);",
341373
" physicsBehavior.addRopeJoint(",
342374
" x1,",
343375
" y1,",
@@ -376,6 +408,12 @@
376408
"description": "Joint connector (center of this object is used to create the joint)",
377409
"name": "Joint",
378410
"type": "objectList"
411+
},
412+
{
413+
"description": "Rope joint connector",
414+
"name": "RopeJoint",
415+
"supplementaryInformation": "JointConnector::RopeJoint",
416+
"type": "behavior"
379417
}
380418
],
381419
"objectGroups": []
@@ -994,7 +1032,6 @@
9941032
"description": "",
9951033
"group": "Motor",
9961034
"extraInformation": [],
997-
"hidden": false,
9981035
"name": "MotorEnabled"
9991036
},
10001037
{
@@ -1004,7 +1041,6 @@
10041041
"description": "If motor speed is 0, then the motor will try to prevent rotation based on motor torque.",
10051042
"group": "Motor",
10061043
"extraInformation": [],
1007-
"hidden": false,
10081044
"name": "MotorTorque"
10091045
},
10101046
{
@@ -1014,7 +1050,6 @@
10141050
"description": "Use negative values to rotate in the opposite direction.",
10151051
"group": "Motor",
10161052
"extraInformation": [],
1017-
"hidden": false,
10181053
"name": "MotorSpeed"
10191054
},
10201055
{
@@ -1024,7 +1059,6 @@
10241059
"description": "",
10251060
"group": "Angle",
10261061
"extraInformation": [],
1027-
"hidden": false,
10281062
"name": "AngleLimitsEnabled"
10291063
},
10301064
{
@@ -1034,7 +1068,6 @@
10341068
"description": "",
10351069
"group": "Angle",
10361070
"extraInformation": [],
1037-
"hidden": false,
10381071
"name": "ClockwiseAngleLimit"
10391072
},
10401073
{
@@ -1044,7 +1077,6 @@
10441077
"description": "",
10451078
"group": "Angle",
10461079
"extraInformation": [],
1047-
"hidden": false,
10481080
"name": "CounterClockwiseAngleLimit"
10491081
},
10501082
{
@@ -1054,7 +1086,6 @@
10541086
"description": "Force required to break joint apart",
10551087
"group": "Breaking joint",
10561088
"extraInformation": [],
1057-
"hidden": false,
10581089
"name": "BreakingForce"
10591090
}
10601091
],
@@ -1247,7 +1278,6 @@
12471278
"description": "Set a number between 0 and 60. Higher numbers represent a stronger bond.",
12481279
"group": "",
12491280
"extraInformation": [],
1250-
"hidden": false,
12511281
"name": "Frequency"
12521282
},
12531283
{
@@ -1257,7 +1287,6 @@
12571287
"description": "Set a number between 0 and 1.",
12581288
"group": "",
12591289
"extraInformation": [],
1260-
"hidden": false,
12611290
"name": "DampingRatio"
12621291
},
12631292
{
@@ -1268,7 +1297,6 @@
12681297
"description": "Force required to break joint apart",
12691298
"group": "Breaking joint",
12701299
"extraInformation": [],
1271-
"hidden": false,
12721300
"name": "BreakingForce"
12731301
}
12741302
],
@@ -1516,7 +1544,6 @@
15161544
"description": "Set a number between 0 and 60. Higher numbers represent a stiffer spring.",
15171545
"group": "",
15181546
"extraInformation": [],
1519-
"hidden": false,
15201547
"name": "Frequency"
15211548
},
15221549
{
@@ -1526,7 +1553,6 @@
15261553
"description": "Set a number between 0 and 1.",
15271554
"group": "",
15281555
"extraInformation": [],
1529-
"hidden": false,
15301556
"name": "DampingRatio"
15311557
},
15321558
{
@@ -1537,7 +1563,6 @@
15371563
"description": "Force required to break joint apart",
15381564
"group": "Breaking joint",
15391565
"extraInformation": [],
1540-
"hidden": false,
15411566
"name": "BreakingForce"
15421567
}
15431568
],
@@ -1972,7 +1997,6 @@
19721997
"description": "Set a number between 0 and 60. Higher numbers represent a stiffer spring.",
19731998
"group": "",
19741999
"extraInformation": [],
1975-
"hidden": false,
19762000
"name": "Frequency"
19772001
},
19782002
{
@@ -1982,7 +2006,6 @@
19822006
"description": "Set a number between 0 and 1.",
19832007
"group": "",
19842008
"extraInformation": [],
1985-
"hidden": false,
19862009
"name": "DampingRatio"
19872010
},
19882011
{
@@ -1993,7 +2016,6 @@
19932016
"description": "Force required to break joint apart",
19942017
"group": "Breaking joint",
19952018
"extraInformation": [],
1996-
"hidden": false,
19972019
"name": "BreakingForce"
19982020
}
19992021
],

0 commit comments

Comments
 (0)