Weld joint 2 objects within the same group

Hey there,

I have a problem with welding 2 objects in a group and I don’t know if it is even possible to do. This is a very simplified example of what I’m trying to do.

Let’s say I have 2 objects, object1 with ID = 1 and object2 with ID = 2. Both are added to a group. I want to do this: weld joint object1 and object2.

BUT, in my project I have many objects, so I want to be able to do this dynamically using the group.

I tried to use 2 groups that both contain the 2 objects, but this doesn’t work.

Is this even possible? A workaround would be very complicated to do. I would appreciate any thoughts on how this can be achieved.

As long as all the parameters match the correct objects and the objects have the right IDs. It should work. They also need to be different objects not different intances of the same object.

I added the weld to Group2.

I added a mouse joint to test it.

If they are the same object then you would need a 2nd object that you could weld them both to.

1 Like

Thank you Keith for your reply! However the issue still persists.

I’m trying this on a new empty project and here’s the setup:

  • I have 2 objects and 2 groups
  • object1 with ID = 1
  • object2 with ID = 2
  • group1 [object1 ; object2]
  • group2 [object1 ; object2]
  • the scene only has these 2 objects, so no other objects or instances
  • the event is the same as in my previous post.

I also tried the sticker extension to stick object1 & object2 and it also doesn’t work.

I did some more testing using a text object and this action to see which objects are being picked:

Here’s what I found:

  • If I add these conditions: ID of group1 = 1 ; ID of group2 =2, then nothing happens and the text doesn’t change.
  • If I add 1 condition to check the ID of any group (for example: ID of group2 = 1), then the text would result in “object1 - object1”.

I’m not sure what’s going on or what to do with this information, but it seems to me that because both objects are in the 2 groups, GDevelop treats them as instances of the same object and can only pick one, so adding 2 conditions will make the event as invalid. This is just my observation and I can be completely wrong about this :sweat_smile:.

I’ll move on for now and try to find a workaround or change the mechanic altogether if it got complicated.

I think because in your test you put both objects in both groups and when I tested it I only put one object in each group.

I believe the issue is when you’re checking the first ID it only picks the matching objects so when you’re picking the 2nd object there’s no objects in the picklist but objects that match the first ID.

Putting both ID equals conditions in an Or works but that doesn’t seem like the best way and could be troublesome.

I’m not sure what you’re making but you wouldn’t be able to weld 2 instances of the same object together. You would need another object to weld them both to or maybe if you pick 2 of the same object, delete 1 and replace it with an instance of the other object. And then weld those 2.

You would need 1 condition that picks them both like group 1 is in collision with group 2 but that would pick all matching sets. Unless you narrowed it down further. With an object variable or something. Again, it depends on your needs.

You either pick both at the same time or selectively only pick from 1 object not the group like if obj1 ID equals, obj2 ID equals.