Describe the project you are working on: It is a 2D Physics Game. I have a "background" layer and a "foreground" layer. Most objects in my game have different collision shapes in each layer. For example, the player almost exclusively exists in the Foreground, however large objects have both Foreground and Background elements. Foreground elements are not passable by the player, but background elements cannot intersect background elements from other objects.
My solution as it stands, I have two independent RigidBodies2D with their own collision shapes and two PinJoint2D with two different positions attached to both nodes. It is quite buggy in edge cases of large objects and strong forces.
Describe how this feature / enhancement will help your project: A single joint that locks position and rotation relative to each other. For my game, I need a 2D version, however Godot also lacks a 3D version.
Show a mock up screenshots/video or a flow diagram explaining how your proposal will work: Same as a PinJoint.
Describe implementation detail for your proposal (in code), if possible: I believe this is just a PinJoint with a relative rotation locking?
If this enhancement will not be used often, can it be worked around with a few lines of script?: It can be approximated by creating two PinJoint2D with different positions or three PinJoint (3d) with different translations. However, a single "joint" is a cleaner, hopefully less buggy, approach.
Is there a reason why this should be core and not an add-on in the asset library?: It's a low level feature that likely should be part of the physics engine.
Unity calls this a "Fixed Joint", so maybe that is the naming scheme we should follow, but "glue" seemed more descriptive to me.
My solution as it stands, I have two independent RigidBodies2D with their own collision shapes and two PinJoint2D with two different positions attached to both nodes. It is quite buggy in edge cases of large objects and strong forces.
Might be a bug with PinJoint2D? If it is, feel free to create an issue about it so it can be fixed =]
It's just a rounding error. The fix is to move the 2nd joint further away from the first one. However, it would still be better to have a joint that locks rotation.
It's just a rounding error. The fix is to move the 2nd joint further away from the first one. However, it would still be better to have a joint that locks rotation.
I see. Seems like a property could be added to the node to enable this behavior? Would that work?
Yeah, that could work. "Match rotation" or "lock relative rotation" flag? Could be useful for the Grove joint too. Although spring joint might want one for each attachment, so a car's socks are locked vertical, but the wheel can still spin.
Another possible issues that can be covered by fixed joint or flag on existing 2d and 3d joints that will lock rotation (or, may be, ability to limit rotation/hinge angle by 0):
Most helpful comment
Another possible issues that can be covered by fixed joint or flag on existing 2d and 3d joints that will lock rotation (or, may be, ability to limit rotation/hinge angle by 0):