Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 52 additions & 30 deletions extensions/community/JointConnector.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"author": "",
"category": "Movement",
"extensionNamespace": "",
"fullName": "Joint connector",
"gdevelopVersion": ">=5.5.222",
"fullName": "Joint Connector",
"helpPath": "",
"iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWh1bWFuIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTIxLDlIMTVWMjJIMTNWMTZIMTFWMjJIOVY5SDNWN0gyMU0xMiwyQTIsMiAwIDAsMSAxNCw0QTIsMiAwIDAsMSAxMiw2QzEwLjg5LDYgMTAsNS4xIDEwLDRDMTAsMi44OSAxMC44OSwyIDEyLDJaIiAvPjwvc3ZnPg==",
"name": "JointConnector",
"previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/8834e0c63a962c74f1dab4c8f918c171261597341c4ca6574b300ab35855274b_human.svg",
"shortDescription": "Create and manage physics joints between two objects.",
"version": "1.1.0",
"version": "1.2.0",
"description": [
"Weld joint",
"- Glue two objects together",
Expand All @@ -29,6 +29,10 @@
"- Two objects can get closer to each other but they cannot exceed their starting distance",
"- Center of both objects must be inside the Joint Connector collision mask"
],
"origin": {
"identifier": "JointConnector",
"name": "gdevelop-extension-store"
},
"tags": [
"joint",
"ragdoll",
Expand All @@ -45,6 +49,8 @@
"rotBq28wITdtfsrE7McHQri4k2w2"
],
"dependencies": [],
"globalVariables": [],
"sceneVariables": [],
"eventsFunctions": [
{
"description": "Connect overlapping physics objects with a revolute joint.",
Expand All @@ -56,13 +62,15 @@
{
"type": "BuiltinCommonInstructions::JsCode",
"inlineCode": [
"const behaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");",
"",
"const physicsBehaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");",
"const jointObjects = eventsFunctionContext.getObjects(\"Joint\");",
"const jointBehaviorBehaviorName = eventsFunctionContext.getBehaviorName(\"RevoluteJoint\");",
"const linkManager = gdjs.LinksManager.getManager(runtimeScene);",
"",
"for (const jointObject of jointObjects) {",
" // Save properties of each joint",
" const jointBehavior = jointObject.getBehavior(\"RevoluteJoint\");",
" const jointBehavior = jointObject.getBehavior(jointBehaviorBehaviorName);",
" const enableLimit = jointBehavior._getAngleLimitsEnabled();",
" const lowerAngle = jointBehavior._getCounterClockwiseAngleLimit();",
" const upperAngle = jointBehavior._getClockwiseAngleLimit();",
Expand All @@ -85,7 +93,7 @@
" }",
" else {",
" /** @type {gdjs.Physics2RuntimeBehavior} */",
" const physicsBehavior = firstObject.getBehavior(behaviorName);",
" const physicsBehavior = firstObject.getBehavior(physicsBehaviorName);",
" const referenceAngle = object.angle - firstObject.angle;",
" physicsBehavior.addRevoluteJointBetweenTwoBodies(",
" x,",
Expand Down Expand Up @@ -131,6 +139,12 @@
"description": "Joint connector (center of this object is used to create the joint)",
"name": "Joint",
"type": "objectList"
},
{
"description": "Revolute joint connector",
"name": "RevoluteJoint",
"supplementaryInformation": "JointConnector::RevoluteJoint",
"type": "behavior"
}
],
"objectGroups": []
Expand All @@ -145,13 +159,15 @@
{
"type": "BuiltinCommonInstructions::JsCode",
"inlineCode": [
"const behaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");",
"",
"const physicsBehaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");",
"const jointObjects = eventsFunctionContext.getObjects(\"Joint\");",
"const jointBehaviorBehaviorName = eventsFunctionContext.getBehaviorName(\"WeldJoint\");",
"const linkManager = gdjs.LinksManager.getManager(runtimeScene);",
"",
"for (const jointObject of jointObjects) {",
" // Save properties of each joint",
" const jointBehavior = jointObject.getBehavior(\"WeldJoint\");",
" const jointBehavior = jointObject.getBehavior(jointBehaviorBehaviorName);",
" const frequency = jointBehavior._getFrequency();",
" const dampingRatio = jointBehavior._getDampingRatio();",
" const collideConnected = false;",
Expand All @@ -170,7 +186,7 @@
" }",
" else {",
" /** @type {gdjs.Physics2RuntimeBehavior} */",
" const physicsBehavior = firstObject.getBehavior(behaviorName);",
" const physicsBehavior = firstObject.getBehavior(physicsBehaviorName);",
" const referenceAngle = object.angle - firstObject.angle;",
" const frequency = 30;",
" const dampingRatio = 1;",
Expand Down Expand Up @@ -214,6 +230,12 @@
"description": "Joint connector (center of this object is used to create the joint)",
"name": "Joint",
"type": "objectList"
},
{
"description": "Weld joint connector",
"name": "RevoluteJoint",
"supplementaryInformation": "JointConnector::WeldJoint",
"type": "behavior"
}
],
"objectGroups": []
Expand All @@ -228,13 +250,15 @@
{
"type": "BuiltinCommonInstructions::JsCode",
"inlineCode": [
"const behaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");",
"",
"const physicsBehaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");",
"const jointObjects = eventsFunctionContext.getObjects(\"Joint\");",
"const jointBehaviorBehaviorName = eventsFunctionContext.getBehaviorName(\"DistanceJoint\");",
"const linkManager = gdjs.LinksManager.getManager(runtimeScene);",
"",
"for (const jointObject of jointObjects) {",
" // Save properties of each joint",
" const jointBehavior = jointObject.getBehavior(\"DistanceJoint\");",
" const jointBehavior = jointObject.getBehavior(jointBehaviorBehaviorName);",
" const length = jointBehavior._getDistance();",
" const frequency = jointBehavior._getFrequency();",
" const dampingRatio = jointBehavior._getDampingRatio();",
Expand All @@ -256,7 +280,7 @@
" var y2 = object.getAABBCenterY();",
" if (jointObject.isCollidingWithPoint(x2, y2)) {",
" /** @type {gdjs.Physics2RuntimeBehavior} */",
" const physicsBehavior = firstObject.getBehavior(behaviorName);",
" const physicsBehavior = firstObject.getBehavior(physicsBehaviorName);",
" physicsBehavior.addDistanceJoint(",
" x1,",
" y1,",
Expand Down Expand Up @@ -297,6 +321,12 @@
"description": "Joint connector (center of this object is used to create the joint)",
"name": "Joint",
"type": "objectList"
},
{
"description": "Distance joint connector",
"name": "RevoluteJoint",
"supplementaryInformation": "JointConnector::DistanceJoint",
"type": "behavior"
}
],
"objectGroups": []
Expand All @@ -311,13 +341,15 @@
{
"type": "BuiltinCommonInstructions::JsCode",
"inlineCode": [
"const behaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");",
"",
"const physicsBehaviorName = eventsFunctionContext.getBehaviorName(\"Physics\");",
"const jointObjects = eventsFunctionContext.getObjects(\"Joint\");",
"const jointBehaviorBehaviorName = eventsFunctionContext.getBehaviorName(\"RopeJoint\");",
"const linkManager = gdjs.LinksManager.getManager(runtimeScene);",
"",
"for (const jointObject of jointObjects) {",
" // Save properties of each joint",
" const jointBehavior = jointObject.getBehavior(\"RopeJoint\");",
" const jointBehavior = jointObject.getBehavior(jointBehaviorBehaviorName);",
" const maxlength = jointBehavior._getMaxDistance();",
" const collideConnected = false;",
"",
Expand All @@ -337,7 +369,7 @@
" var y2 = object.getAABBCenterY();",
" if (jointObject.isCollidingWithPoint(x2, y2)) {",
" /** @type {gdjs.Physics2RuntimeBehavior} */",
" const physicsBehavior = firstObject.getBehavior(behaviorName);",
" const physicsBehavior = firstObject.getBehavior(physicsBehaviorName);",
" physicsBehavior.addRopeJoint(",
" x1,",
" y1,",
Expand Down Expand Up @@ -376,6 +408,12 @@
"description": "Joint connector (center of this object is used to create the joint)",
"name": "Joint",
"type": "objectList"
},
{
"description": "Rope joint connector",
"name": "RopeJoint",
"supplementaryInformation": "JointConnector::RopeJoint",
"type": "behavior"
}
],
"objectGroups": []
Expand Down Expand Up @@ -994,7 +1032,6 @@
"description": "",
"group": "Motor",
"extraInformation": [],
"hidden": false,
"name": "MotorEnabled"
},
{
Expand All @@ -1004,7 +1041,6 @@
"description": "If motor speed is 0, then the motor will try to prevent rotation based on motor torque.",
"group": "Motor",
"extraInformation": [],
"hidden": false,
"name": "MotorTorque"
},
{
Expand All @@ -1014,7 +1050,6 @@
"description": "Use negative values to rotate in the opposite direction.",
"group": "Motor",
"extraInformation": [],
"hidden": false,
"name": "MotorSpeed"
},
{
Expand All @@ -1024,7 +1059,6 @@
"description": "",
"group": "Angle",
"extraInformation": [],
"hidden": false,
"name": "AngleLimitsEnabled"
},
{
Expand All @@ -1034,7 +1068,6 @@
"description": "",
"group": "Angle",
"extraInformation": [],
"hidden": false,
"name": "ClockwiseAngleLimit"
},
{
Expand All @@ -1044,7 +1077,6 @@
"description": "",
"group": "Angle",
"extraInformation": [],
"hidden": false,
"name": "CounterClockwiseAngleLimit"
},
{
Expand All @@ -1054,7 +1086,6 @@
"description": "Force required to break joint apart",
"group": "Breaking joint",
"extraInformation": [],
"hidden": false,
"name": "BreakingForce"
}
],
Expand Down Expand Up @@ -1247,7 +1278,6 @@
"description": "Set a number between 0 and 60. Higher numbers represent a stronger bond.",
"group": "",
"extraInformation": [],
"hidden": false,
"name": "Frequency"
},
{
Expand All @@ -1257,7 +1287,6 @@
"description": "Set a number between 0 and 1.",
"group": "",
"extraInformation": [],
"hidden": false,
"name": "DampingRatio"
},
{
Expand All @@ -1268,7 +1297,6 @@
"description": "Force required to break joint apart",
"group": "Breaking joint",
"extraInformation": [],
"hidden": false,
"name": "BreakingForce"
}
],
Expand Down Expand Up @@ -1516,7 +1544,6 @@
"description": "Set a number between 0 and 60. Higher numbers represent a stiffer spring.",
"group": "",
"extraInformation": [],
"hidden": false,
"name": "Frequency"
},
{
Expand All @@ -1526,7 +1553,6 @@
"description": "Set a number between 0 and 1.",
"group": "",
"extraInformation": [],
"hidden": false,
"name": "DampingRatio"
},
{
Expand All @@ -1537,7 +1563,6 @@
"description": "Force required to break joint apart",
"group": "Breaking joint",
"extraInformation": [],
"hidden": false,
"name": "BreakingForce"
}
],
Expand Down Expand Up @@ -1972,7 +1997,6 @@
"description": "Set a number between 0 and 60. Higher numbers represent a stiffer spring.",
"group": "",
"extraInformation": [],
"hidden": false,
"name": "Frequency"
},
{
Expand All @@ -1982,7 +2006,6 @@
"description": "Set a number between 0 and 1.",
"group": "",
"extraInformation": [],
"hidden": false,
"name": "DampingRatio"
},
{
Expand All @@ -1993,7 +2016,6 @@
"description": "Force required to break joint apart",
"group": "Breaking joint",
"extraInformation": [],
"hidden": false,
"name": "BreakingForce"
}
],
Expand Down