@EpicDankDude said:
What is clone = new_clone
?
I just assigned it to clone
to fit the example OP code, as I wasn't sure if the code was using a class variable or a function one.
Looks like the ragdoll bones just break off, does duplicate() duplicate PinJoint2D?
I mean, the bones act all ragdolly but they snap off lol
If the PinJoint2D settings are setup in the Ragdoll
scene, then it should copy them. You may need to do duplicate(true)
, with the second parameter telling Godot to do a deep copy. I'm not sure if that would fix it, but it may. It could be that Joint2D-based nodes use absolute NodePaths or when duplicating the paths link to the original joints in the original Ragdoll, so that's why they are not connected.
If you can, you may also potentially want to save the ragdoll as a scene and then instance it instead of duplicating the ragdoll node if you cannot get duplicate joints working. Instanced scenes should have working joints when a new clone/instance is created via code.