bi are objects and b is the group of all bi
I want all instances of b to be able to collide.
condition: b is in collision with b, doesn’t work
condition: b1 is in collision with b event separate b1 and b works but it’s not nice, they don’t bounce. So i want a force or impulse but they don’t work.
Is there a way to do it without writing for each bi?
bi are objects and b is the group of all bi
Hi and welcome here
I’m not sure what you mean by “it’s not nice, they don’t bounce.”
And instant force with negative number works, so I don’t know what you mean by “they don’t work”.
Anyway, the best solution for your issue is probably to make a custom behavior for your b1 objects.
Object is in collision with OtherObject → do things.
Custom behaviors are not the easiest, you may want to check the wiki or find some tutorials.
I meant the force isn’t applied and the objects aren’t affected at all. If I do it on b1 and b2 it works but I need to do it on all the objects of the group b. There it doesn’t work.
I will look into behaviors thank you!
When you check for collisions between the same instances, Gdevelop doesn’t know the difference between instances. It will pick each instance that’s in collision but there’s no way to differentiate between them without some other information like an ID variable but even then, it’s complicated.
The for each object event picks only one instance at a time. Since the object and group are the same object, it’s just trying to move itself.
What does your scene look like? A screenshot might help. Someone should be able to give you a more specific answer. The answer most likely will be to use at least 2 different objects even if one is hidden and used to collisions.
just some balls bouncing
Have you tried the Bounce behavior?
I’m trying to use it but the wiki and tutorials really suck! They don’t explain sht. Sorry this is terrible. I wonder how the engine is made if the team can’t even explain rationally easy things like functions
You said “bouncing balls”. The more details you give. The better the answers you’ll receive. We’re here to help. We just need a few more detais.
There are 2 main ways to move objects with and without the physics behavior. The physics behavior can be difficult but once setup, it takes care of a lot of the interactions.
I don’t know your level. I would checkout the tutorials, examples and templates. YouTube is also a good source.
The bounce behavior is added to any object that might need to bounce off of something like a wall. You assign the behavior to the ball. Once assigned it adds the following actions.
On the ball, you would use ball object is in collision with wall object as the condition along with a trigger once. You would use one of the bounce actions as an action for the ball object.
the bounce behavior can’t be added to any object. Maybe it’s a bug. As for the tutorials and wiki they are good if you’re a total beginner. But then they’re worthless. Come on, it’s just blah blah with no explanations.
Chiming in here from a moderation standpoint.
Please cut out the random expletives and insults going forward.
I understand you may be frustrated that you aren’t learning, finding, or understanding what you are looking for, but a base level of conduct is expected on the forums and community.
The behavior should work. At least it should allow it to be added. It’s possible that you added the behavior to your project but not to the object.
Unlike the default installed behaviors, new behaviors have to be first added to the project (just once per project) and then clicked again to actually be added to the object. The first click just installs it.
but I need to add it to several objects or to the whole group. That was the purpose of my post.
I would agree with the other posters that adding bounce to each object in your group (object groups themselves are just high-level heirarchal objects, and you cannot apply behaviors to groups) may help accomplish what you want. That way any instance of an object in that group can bounce.
If you’re wanting to get more specific on which object you’re addressing, I’d recommend checking out the “Object Picking Tools” community extension in the extension list. The “Pick first” or “Pick Nth” conditions may be helpful from that extension (although you will likely need subevents if you’re going to loop through multiple, to not limit it to only the first or the nth picked instance). Beyond that, you’ll need to play around with your game logic.
Unfortunately, collision handling for multiple instance of the same object is an issue in pretty much every 2D (and many 3D) engine (you can find dozens of threads for Construct 3, Unity, etc). Using variables to track Object Instance IDs can help, but only if you’re specifically trying to target a very specific instance and you already know the ID, which is unlikely to apply in your scenario above.
If all of the objects are instances of the same object then adding a behavior to one object adds it to all of the instaces of that object whether created at design time or through code. I’m not saying this is a fix.
Depending on your goal, the physics behavior might be a better fit. The bounce behavior is not for physics and you have to make sure you use the force actions created by the physics behavior. It also uses a separate collision mask.