Hello all!
Im new here. GDevelop, is awesome program, but i have problem. Is here way to disable collision between two sprites?
I play with gravity and fall - i have sprite of ship and 2 gears. Gear is below sprite of ship (Z order). If i turn all collision detect enabled in gravitation behaviour, then they crazy interract among themselves. I need disable collision check between gear and core ship. Is it possible either event, or script? Thanks all for respond. Salute and bb.
(PS: Im not natural Eng. speaker, then sorry for mistakes)
I don’t understand : if you don’t use the condition “collision between 2 objets”, there will be no collision between them. Also it’s possible to create maybe 2 animation in your spprite : one with collision mask, one without collision mask.
I think he/she is talking about the Physics automatism, the only way it all makes sense…
GDevelop doesn’t support collision masks (yet), but maybe you can enable masks through code. I’ve made it in Javascript, and works fine, not sure about C++, let me check it out later (at night)
Ok… not able to do it in C++ (C++ is fast and powerful but hard ), the Box2D include directory is not added in compile time. I can copy the library to an existing included directory, it works in preview but surely will break in compiled games. Anyway I’m getting an error with SetFilterData
For native games, a workaround could be to have two Physics Automatism: “Physics” and “Physics2”.
For the ship add “Physics”, for the gear add “Physics2”, for objects that needs to collide with ship and/or gear add “Physics” and/or “Physics2”. It’s a bad workaroun, I know
For HTML5 games, have two Physics Automatism is not an option (just doesn’t work), but you have something better, Javascript. At the beginning of the scene modify some properties of the physics body (more precisely of the fixture or its filter data).
Here is an example: CollisionFilter.zip (8.73 KB)
Note that the code assumes there will be at least one object being considered (if you have conditions that no object fulfils and you put this code as subevent, it will break I think), and that the object has a Physics automatism called “Physics”. Object with the defaul filter (as the ground in the example) will collide with both objects