An empty container collision mask

Hello,

I need this sprite to act as an empty dish in my game to collect the ball.
How can I make this sprite empty?

My tries:

And an overview of the screen:

Please inform me.

regards,

Use multiple collision masks on the sprite. Instead of clicking on the “Add vertex” button, click on the “Add collision mask” button:

Here is a link to a recent thread briefly explaining it

And a lint to much older thread with a slightly better explanation.

I did what you told me but still have the same problem!!

thanks,

Are you sure about what you are saying?

I tried a lot but none of them works!

What are you expecting to happen? What are you trying to do? Do you want to detect the collision with the trash can or with the empty space inside the can?

Note: This only adjusts the basic collision mask. If you are using the physics behavior, it has its own simplistic mask. You might need multiple physics objects depending on what you’re trying to do.

Are there any errors?
image

Yes, I’m using physics behavior.

Imagine we have an empty can where the balls are shot and collected in it. Both the can and the ball have physics behavior.

This makes sense now. Your screenshots are showing you modifying the normal sprite collision mask. This isn’t used in any way by the physica behavior. You will need to modify the shape/polygon on the physics behavior itself on the behavior tab.

The physics behavior mask can’t be concave and it doesn’t allow for multiple masks per object.

If the can is fixed then just add 3 shapes and set them to static.

If the can follows the cursor then here’s a simple example using 3 objects, a base, a left wall and right wall. The walls get welded to the base and a mouse joint is used to make the base follow the mouse X and a fixed Y.

Try me
https://gd.games/keith_13579/economic-burst

I don’t know how familiar you are with physics and I know the event sheet doesn’t show the settings. If this is what you want and you need more help setting up the physics we can help. I’m on my phone and taking and cropping screenshots isn’t as easy as when I’m at my PC.

I used the bounding box values for positioning but you can create custom points on the objects and use them. You can also make adjustments do the walls don’t wiggle. Although, the wiggle is fun.

The mouse joint uses a scene variable named joint for the joint ID.

Edit: I tried the example on my PC and it was way too wobbly but the mouse joint has a lot of settings to fix that or another method can be used.

1 Like

Thank you for your help and the sample you created.
What is in my mind is something like:

Is it possible to do this part of masking in gdevelop?

Can you explain a bit more about physics hidden objects?

That looks relatively simple. It wouldn’t need masking. The more complex shapes could be made from a regular sprite with hidden physics objects. I’m not saying it will be easy but relatively easy because once you perfect a mechanism you’ll be able to add objects where ever you want to without changing the code. The events would sort of scan the objects and setup any joints at the beginning. Once the joints are initiated the physics behavior would take care of most of the action.

The bottom basket could be an image with like 5 hidden physics objects set to static.

The levels could be created either through external layouts or separate scenes using external external events and/or extensions. The main thing is you would only create the events once either in the single scene with external objects or multiple scenes using external events or functions.

The key is to try to never repeat the same events unless you really have to. It’s so much easier if there’s just one set of events to create, debug and update when your strategy changes or you need to modify or add features.

A lot of the physics joints have motors for the spinning and sliding parts like the Revolute and Prismatic Joints. The speed, direction and limits could be set with objects variables. Any joint could be added at the beginning.

https://wiki.gdevelop.io/gdevelop5/behaviors/physics2/#controlling-object-movement-with-joints

I would start with a crude mockup and worry about the scoring and everything else later. The scene would have all of the fixed objects like the score and the basket. Everyone has their own process and preferences.

Then start with testing the different obstacle objects one at a time starting with the static obstacles. You could start with a single scene and work on the level changes later. Again, everyone has their own style. Our brains all work differently. We all like to approach things from different directions. Some people like to perfect the graphics and others like to work on the mechanics and use simple basic images and replace them later.

Start with the shooter and the basket and then add 1 obstacle type at a time. Asking for any assistance when needed. Just try to limit each post to one concept. You’ll get quicker responses.

I wish you good luck. This looks like a fun project. Create your own twists and obstacles to make it unique.

I made something like a glass with physic joints.
But very curious about the hidden physic objects to improve my game.
Is there any explanation for this?
Can anyone guide me on this topic?

regards,

I’m just saying for some items that require multiple physics objects you can use a regular sprite for the visuals and sprites with the physics behavior to handle the collisions. They work the same way whether they’re visible or hidden. You just hide them at the beginning.

Thanks.
Is it possible that our can is semi-circular at the bottom with this method?

You can have a detailed image of the can and then arrange several hidden objects with physics behaviors just set the objects to static and hide them at the beginning. You could use more shapes.
20240525_213940

1 Like