You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there! Regardless of our opinions on Roblox Studio, it does one thing objectively better than Godot, and it is the physics constraints system.
I'm not going to base this discussion that much on how i want attachments, but instead start simpler by requesting a WeldJoint2D to be added (as a simpler and more performant replacement to PinJoint2D with limits set to 0).
This Weld will work just like Roblox's WeldConstraint as it has its initial offsets and keeps them, effectively allowing you to compose complex physical objects that end up acting like a single object (also iirc you can modify the offset with script). Usecases are literally everywhere, just look at how often someone uses welds in Roblox, every complex assembly has them.
assembly - In Roblox terms, this is a physics object composed of one or multiple parts, calculated because of WeldConstraint connections. You have linear velocity which is the global of each part and assembly linear velocity which is the global of the assembly. Same for angular velocity.
This could potentially be scripted simply, but ideally it needs to account for both objects and i suck at scripting so i could only fix object B relative to object A which makes object B behave unintuitively. Ideally both objects should act like one complex physics object and not like a weird system where A tugs on B, but B can't tug on A.
I tried implementing WeldJoint2D by copying the source code for PinJoint2D, searching all the references to stuff related to PinJoint2D and adding WeldJoint2D wherever relevant and used some help from Gemini ai and it works... although it copies over a bug currently in the engine related to PinJoint2D limits causing it to freak out, fixed by godotengine/godot#104539 and here's my fork without this bugfix, but with the joint: https://github.com/tomsterBG/godot/tree/4.4.1%2B%2B%2B/weld-joint-2d
My implementation sucks because i copy the code of PinJoint2D and delete whatever i don't find to be necessary and i understood how stuff works on the fly as i wrote and deleted. I barely know any C++ as my experience boils down to a 2-year course that was like 7 years ago so i'm figuring it out again after completely forgetting it.
My implementation has an editor icon for WeldJoint2D too which you could use as inspiration (depicting two squares overlapping and a fixture where they overlap):
And docs that you can check in the link above, as it links to my branch. However this branch also contains some of my other additions, but it's just 3 commits that should be easy to discard.
I know better than to shove multiple ideas in one discussion proposal, but still i feel like a major thing here should be the goal to actually create a nice constraint system like Roblox's attachment + constraint stuff instead of just the few limited joints Godot provides. Plus for OCD perfection attachments set the coordinates of A and B so even if you want to more easily build a thing in the scene tree, you can without having to put it back together every time you want to build something and see what you're doing. For example i can move my parts however i want, but as long as the attachments relative to the parts stay untouched, the behavior of the attachment will not change.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hey there! Regardless of our opinions on Roblox Studio, it does one thing objectively better than Godot, and it is the physics constraints system.
I'm not going to base this discussion that much on how i want attachments, but instead start simpler by requesting a WeldJoint2D to be added (as a simpler and more performant replacement to PinJoint2D with limits set to 0).
This Weld will work just like Roblox's WeldConstraint as it has its initial offsets and keeps them, effectively allowing you to compose complex physical objects that end up acting like a single object (also iirc you can modify the offset with script). Usecases are literally everywhere, just look at how often someone uses welds in Roblox, every complex assembly has them.
assembly - In Roblox terms, this is a physics object composed of one or multiple parts, calculated because of WeldConstraint connections. You have linear velocity which is the global of each part and assembly linear velocity which is the global of the assembly. Same for angular velocity.
This could potentially be scripted simply, but ideally it needs to account for both objects and i suck at scripting so i could only fix object B relative to object A which makes object B behave unintuitively. Ideally both objects should act like one complex physics object and not like a weird system where A tugs on B, but B can't tug on A.
I tried implementing WeldJoint2D by copying the source code for PinJoint2D, searching all the references to stuff related to PinJoint2D and adding WeldJoint2D wherever relevant and used some help from Gemini ai and it works... although it copies over a bug currently in the engine related to PinJoint2D limits causing it to freak out, fixed by godotengine/godot#104539 and here's my fork without this bugfix, but with the joint: https://github.com/tomsterBG/godot/tree/4.4.1%2B%2B%2B/weld-joint-2d
My implementation sucks because i copy the code of PinJoint2D and delete whatever i don't find to be necessary and i understood how stuff works on the fly as i wrote and deleted. I barely know any C++ as my experience boils down to a 2-year course that was like 7 years ago so i'm figuring it out again after completely forgetting it.
My implementation has an editor icon for WeldJoint2D too which you could use as inspiration (depicting two squares overlapping and a fixture where they overlap):

And docs that you can check in the link above, as it links to my branch. However this branch also contains some of my other additions, but it's just 3 commits that should be easy to discard.
I know better than to shove multiple ideas in one discussion proposal, but still i feel like a major thing here should be the goal to actually create a nice constraint system like Roblox's attachment + constraint stuff instead of just the few limited joints Godot provides. Plus for OCD perfection attachments set the coordinates of A and B so even if you want to more easily build a thing in the scene tree, you can without having to put it back together every time you want to build something and see what you're doing. For example i can move my parts however i want, but as long as the attachments relative to the parts stay untouched, the behavior of the attachment will not change.
Beta Was this translation helpful? Give feedback.
All reactions