|
2 | 2 | "author": "", |
3 | 3 | "category": "Movement", |
4 | 4 | "extensionNamespace": "", |
| 5 | + "fullName": "Joint connector", |
5 | 6 | "gdevelopVersion": ">=5.5.222", |
6 | | - "fullName": "Joint Connector", |
7 | 7 | "helpPath": "", |
8 | 8 | "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWh1bWFuIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTIxLDlIMTVWMjJIMTNWMTZIMTFWMjJIOVY5SDNWN0gyMU0xMiwyQTIsMiAwIDAsMSAxNCw0QTIsMiAwIDAsMSAxMiw2QzEwLjg5LDYgMTAsNS4xIDEwLDRDMTAsMi44OSAxMC44OSwyIDEyLDJaIiAvPjwvc3ZnPg==", |
9 | 9 | "name": "JointConnector", |
10 | 10 | "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/8834e0c63a962c74f1dab4c8f918c171261597341c4ca6574b300ab35855274b_human.svg", |
11 | 11 | "shortDescription": "Create and manage physics joints between two objects.", |
12 | | - "version": "1.1.0", |
| 12 | + "version": "1.2.0", |
13 | 13 | "description": [ |
14 | 14 | "Weld joint", |
15 | 15 | "- Glue two objects together", |
|
29 | 29 | "- Two objects can get closer to each other but they cannot exceed their starting distance", |
30 | 30 | "- Center of both objects must be inside the Joint Connector collision mask" |
31 | 31 | ], |
| 32 | + "origin": { |
| 33 | + "identifier": "JointConnector", |
| 34 | + "name": "gdevelop-extension-store" |
| 35 | + }, |
32 | 36 | "tags": [ |
33 | 37 | "joint", |
34 | 38 | "ragdoll", |
|
45 | 49 | "rotBq28wITdtfsrE7McHQri4k2w2" |
46 | 50 | ], |
47 | 51 | "dependencies": [], |
| 52 | + "globalVariables": [], |
| 53 | + "sceneVariables": [], |
48 | 54 | "eventsFunctions": [ |
49 | 55 | { |
50 | 56 | "description": "Connect overlapping physics objects with a revolute joint.", |
|
56 | 62 | { |
57 | 63 | "type": "BuiltinCommonInstructions::JsCode", |
58 | 64 | "inlineCode": [ |
59 | | - "const behaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");", |
| 65 | + "", |
| 66 | + "const physicsBehaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");", |
60 | 67 | "const jointObjects = eventsFunctionContext.getObjects(\"Joint\");", |
| 68 | + "const jointBehaviorBehaviorName = eventsFunctionContext.getBehaviorName(\"RevoluteJoint\");", |
61 | 69 | "const linkManager = gdjs.LinksManager.getManager(runtimeScene);", |
62 | 70 | "", |
63 | 71 | "for (const jointObject of jointObjects) {", |
64 | 72 | " // Save properties of each joint", |
65 | | - " const jointBehavior = jointObject.getBehavior(\"RevoluteJoint\");", |
| 73 | + " const jointBehavior = jointObject.getBehavior(jointBehaviorBehaviorName);", |
66 | 74 | " const enableLimit = jointBehavior._getAngleLimitsEnabled();", |
67 | 75 | " const lowerAngle = jointBehavior._getCounterClockwiseAngleLimit();", |
68 | 76 | " const upperAngle = jointBehavior._getClockwiseAngleLimit();", |
|
85 | 93 | " }", |
86 | 94 | " else {", |
87 | 95 | " /** @type {gdjs.Physics2RuntimeBehavior} */", |
88 | | - " const physicsBehavior = firstObject.getBehavior(behaviorName);", |
| 96 | + " const physicsBehavior = firstObject.getBehavior(physicsBehaviorName);", |
89 | 97 | " const referenceAngle = object.angle - firstObject.angle;", |
90 | 98 | " physicsBehavior.addRevoluteJointBetweenTwoBodies(", |
91 | 99 | " x,", |
|
131 | 139 | "description": "Joint connector (center of this object is used to create the joint)", |
132 | 140 | "name": "Joint", |
133 | 141 | "type": "objectList" |
| 142 | + }, |
| 143 | + { |
| 144 | + "description": "Revolute joint connector", |
| 145 | + "name": "RevoluteJoint", |
| 146 | + "supplementaryInformation": "JointConnector::RevoluteJoint", |
| 147 | + "type": "behavior" |
134 | 148 | } |
135 | 149 | ], |
136 | 150 | "objectGroups": [] |
|
145 | 159 | { |
146 | 160 | "type": "BuiltinCommonInstructions::JsCode", |
147 | 161 | "inlineCode": [ |
148 | | - "const behaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");", |
| 162 | + "", |
| 163 | + "const physicsBehaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");", |
149 | 164 | "const jointObjects = eventsFunctionContext.getObjects(\"Joint\");", |
| 165 | + "const jointBehaviorBehaviorName = eventsFunctionContext.getBehaviorName(\"WeldJoint\");", |
150 | 166 | "const linkManager = gdjs.LinksManager.getManager(runtimeScene);", |
151 | 167 | "", |
152 | 168 | "for (const jointObject of jointObjects) {", |
153 | 169 | " // Save properties of each joint", |
154 | | - " const jointBehavior = jointObject.getBehavior(\"WeldJoint\");", |
| 170 | + " const jointBehavior = jointObject.getBehavior(jointBehaviorBehaviorName);", |
155 | 171 | " const frequency = jointBehavior._getFrequency();", |
156 | 172 | " const dampingRatio = jointBehavior._getDampingRatio();", |
157 | 173 | " const collideConnected = false;", |
|
170 | 186 | " }", |
171 | 187 | " else {", |
172 | 188 | " /** @type {gdjs.Physics2RuntimeBehavior} */", |
173 | | - " const physicsBehavior = firstObject.getBehavior(behaviorName);", |
| 189 | + " const physicsBehavior = firstObject.getBehavior(physicsBehaviorName);", |
174 | 190 | " const referenceAngle = object.angle - firstObject.angle;", |
175 | 191 | " const frequency = 30;", |
176 | 192 | " const dampingRatio = 1;", |
|
214 | 230 | "description": "Joint connector (center of this object is used to create the joint)", |
215 | 231 | "name": "Joint", |
216 | 232 | "type": "objectList" |
| 233 | + }, |
| 234 | + { |
| 235 | + "description": "Weld joint connector", |
| 236 | + "name": "RevoluteJoint", |
| 237 | + "supplementaryInformation": "JointConnector::WeldJoint", |
| 238 | + "type": "behavior" |
217 | 239 | } |
218 | 240 | ], |
219 | 241 | "objectGroups": [] |
|
228 | 250 | { |
229 | 251 | "type": "BuiltinCommonInstructions::JsCode", |
230 | 252 | "inlineCode": [ |
231 | | - "const behaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");", |
| 253 | + "", |
| 254 | + "const physicsBehaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");", |
232 | 255 | "const jointObjects = eventsFunctionContext.getObjects(\"Joint\");", |
| 256 | + "const jointBehaviorBehaviorName = eventsFunctionContext.getBehaviorName(\"DistanceJoint\");", |
233 | 257 | "const linkManager = gdjs.LinksManager.getManager(runtimeScene);", |
234 | 258 | "", |
235 | 259 | "for (const jointObject of jointObjects) {", |
236 | 260 | " // Save properties of each joint", |
237 | | - " const jointBehavior = jointObject.getBehavior(\"DistanceJoint\");", |
| 261 | + " const jointBehavior = jointObject.getBehavior(jointBehaviorBehaviorName);", |
238 | 262 | " const length = jointBehavior._getDistance();", |
239 | 263 | " const frequency = jointBehavior._getFrequency();", |
240 | 264 | " const dampingRatio = jointBehavior._getDampingRatio();", |
|
256 | 280 | " var y2 = object.getAABBCenterY();", |
257 | 281 | " if (jointObject.isCollidingWithPoint(x2, y2)) {", |
258 | 282 | " /** @type {gdjs.Physics2RuntimeBehavior} */", |
259 | | - " const physicsBehavior = firstObject.getBehavior(behaviorName);", |
| 283 | + " const physicsBehavior = firstObject.getBehavior(physicsBehaviorName);", |
260 | 284 | " physicsBehavior.addDistanceJoint(", |
261 | 285 | " x1,", |
262 | 286 | " y1,", |
|
297 | 321 | "description": "Joint connector (center of this object is used to create the joint)", |
298 | 322 | "name": "Joint", |
299 | 323 | "type": "objectList" |
| 324 | + }, |
| 325 | + { |
| 326 | + "description": "Distance joint connector", |
| 327 | + "name": "RevoluteJoint", |
| 328 | + "supplementaryInformation": "JointConnector::DistanceJoint", |
| 329 | + "type": "behavior" |
300 | 330 | } |
301 | 331 | ], |
302 | 332 | "objectGroups": [] |
|
311 | 341 | { |
312 | 342 | "type": "BuiltinCommonInstructions::JsCode", |
313 | 343 | "inlineCode": [ |
314 | | - "const behaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");", |
| 344 | + "", |
| 345 | + "const physicsBehaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");", |
315 | 346 | "const jointObjects = eventsFunctionContext.getObjects(\"Joint\");", |
| 347 | + "const jointBehaviorBehaviorName = eventsFunctionContext.getBehaviorName(\"RopeJoint\");", |
316 | 348 | "const linkManager = gdjs.LinksManager.getManager(runtimeScene);", |
317 | 349 | "", |
318 | 350 | "for (const jointObject of jointObjects) {", |
319 | 351 | " // Save properties of each joint", |
320 | | - " const jointBehavior = jointObject.getBehavior(\"RopeJoint\");", |
| 352 | + " const jointBehavior = jointObject.getBehavior(jointBehaviorBehaviorName);", |
321 | 353 | " const maxlength = jointBehavior._getMaxDistance();", |
322 | 354 | " const collideConnected = false;", |
323 | 355 | "", |
|
337 | 369 | " var y2 = object.getAABBCenterY();", |
338 | 370 | " if (jointObject.isCollidingWithPoint(x2, y2)) {", |
339 | 371 | " /** @type {gdjs.Physics2RuntimeBehavior} */", |
340 | | - " const physicsBehavior = firstObject.getBehavior(behaviorName);", |
| 372 | + " const physicsBehavior = firstObject.getBehavior(physicsBehaviorName);", |
341 | 373 | " physicsBehavior.addRopeJoint(", |
342 | 374 | " x1,", |
343 | 375 | " y1,", |
|
376 | 408 | "description": "Joint connector (center of this object is used to create the joint)", |
377 | 409 | "name": "Joint", |
378 | 410 | "type": "objectList" |
| 411 | + }, |
| 412 | + { |
| 413 | + "description": "Rope joint connector", |
| 414 | + "name": "RopeJoint", |
| 415 | + "supplementaryInformation": "JointConnector::RopeJoint", |
| 416 | + "type": "behavior" |
379 | 417 | } |
380 | 418 | ], |
381 | 419 | "objectGroups": [] |
|
994 | 1032 | "description": "", |
995 | 1033 | "group": "Motor", |
996 | 1034 | "extraInformation": [], |
997 | | - "hidden": false, |
998 | 1035 | "name": "MotorEnabled" |
999 | 1036 | }, |
1000 | 1037 | { |
|
1004 | 1041 | "description": "If motor speed is 0, then the motor will try to prevent rotation based on motor torque.", |
1005 | 1042 | "group": "Motor", |
1006 | 1043 | "extraInformation": [], |
1007 | | - "hidden": false, |
1008 | 1044 | "name": "MotorTorque" |
1009 | 1045 | }, |
1010 | 1046 | { |
|
1014 | 1050 | "description": "Use negative values to rotate in the opposite direction.", |
1015 | 1051 | "group": "Motor", |
1016 | 1052 | "extraInformation": [], |
1017 | | - "hidden": false, |
1018 | 1053 | "name": "MotorSpeed" |
1019 | 1054 | }, |
1020 | 1055 | { |
|
1024 | 1059 | "description": "", |
1025 | 1060 | "group": "Angle", |
1026 | 1061 | "extraInformation": [], |
1027 | | - "hidden": false, |
1028 | 1062 | "name": "AngleLimitsEnabled" |
1029 | 1063 | }, |
1030 | 1064 | { |
|
1034 | 1068 | "description": "", |
1035 | 1069 | "group": "Angle", |
1036 | 1070 | "extraInformation": [], |
1037 | | - "hidden": false, |
1038 | 1071 | "name": "ClockwiseAngleLimit" |
1039 | 1072 | }, |
1040 | 1073 | { |
|
1044 | 1077 | "description": "", |
1045 | 1078 | "group": "Angle", |
1046 | 1079 | "extraInformation": [], |
1047 | | - "hidden": false, |
1048 | 1080 | "name": "CounterClockwiseAngleLimit" |
1049 | 1081 | }, |
1050 | 1082 | { |
|
1054 | 1086 | "description": "Force required to break joint apart", |
1055 | 1087 | "group": "Breaking joint", |
1056 | 1088 | "extraInformation": [], |
1057 | | - "hidden": false, |
1058 | 1089 | "name": "BreakingForce" |
1059 | 1090 | } |
1060 | 1091 | ], |
|
1247 | 1278 | "description": "Set a number between 0 and 60. Higher numbers represent a stronger bond.", |
1248 | 1279 | "group": "", |
1249 | 1280 | "extraInformation": [], |
1250 | | - "hidden": false, |
1251 | 1281 | "name": "Frequency" |
1252 | 1282 | }, |
1253 | 1283 | { |
|
1257 | 1287 | "description": "Set a number between 0 and 1.", |
1258 | 1288 | "group": "", |
1259 | 1289 | "extraInformation": [], |
1260 | | - "hidden": false, |
1261 | 1290 | "name": "DampingRatio" |
1262 | 1291 | }, |
1263 | 1292 | { |
|
1268 | 1297 | "description": "Force required to break joint apart", |
1269 | 1298 | "group": "Breaking joint", |
1270 | 1299 | "extraInformation": [], |
1271 | | - "hidden": false, |
1272 | 1300 | "name": "BreakingForce" |
1273 | 1301 | } |
1274 | 1302 | ], |
|
1516 | 1544 | "description": "Set a number between 0 and 60. Higher numbers represent a stiffer spring.", |
1517 | 1545 | "group": "", |
1518 | 1546 | "extraInformation": [], |
1519 | | - "hidden": false, |
1520 | 1547 | "name": "Frequency" |
1521 | 1548 | }, |
1522 | 1549 | { |
|
1526 | 1553 | "description": "Set a number between 0 and 1.", |
1527 | 1554 | "group": "", |
1528 | 1555 | "extraInformation": [], |
1529 | | - "hidden": false, |
1530 | 1556 | "name": "DampingRatio" |
1531 | 1557 | }, |
1532 | 1558 | { |
|
1537 | 1563 | "description": "Force required to break joint apart", |
1538 | 1564 | "group": "Breaking joint", |
1539 | 1565 | "extraInformation": [], |
1540 | | - "hidden": false, |
1541 | 1566 | "name": "BreakingForce" |
1542 | 1567 | } |
1543 | 1568 | ], |
|
1972 | 1997 | "description": "Set a number between 0 and 60. Higher numbers represent a stiffer spring.", |
1973 | 1998 | "group": "", |
1974 | 1999 | "extraInformation": [], |
1975 | | - "hidden": false, |
1976 | 2000 | "name": "Frequency" |
1977 | 2001 | }, |
1978 | 2002 | { |
|
1982 | 2006 | "description": "Set a number between 0 and 1.", |
1983 | 2007 | "group": "", |
1984 | 2008 | "extraInformation": [], |
1985 | | - "hidden": false, |
1986 | 2009 | "name": "DampingRatio" |
1987 | 2010 | }, |
1988 | 2011 | { |
|
1993 | 2016 | "description": "Force required to break joint apart", |
1994 | 2017 | "group": "Breaking joint", |
1995 | 2018 | "extraInformation": [], |
1996 | | - "hidden": false, |
1997 | 2019 | "name": "BreakingForce" |
1998 | 2020 | } |
1999 | 2021 | ], |
|
0 commit comments