medium and large asteroids collide

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Timofey

medium and large asteroids collide. I tried to turn off masks and layers for medium asteroids altogether, but they love to come into contact with large asteroids. How to fix this, please tell me.


I tried to find a fix, but I also cannot see where the incorrect collision mask is being set for the medium asteroid. Very strange!

Tim Martin | 2020-09-27 13:21

sorry, I did not understand you. I don’t really understand correctly what a layer and a mask are. Is the layer processing the input signal and the mask giving the output signal?

Timofey | 2020-09-27 13:45

Sort of. Layer = which layers is my collision object in layer 1 could be Player, layer 2 could be asteroids, layer 3 could be pickups. Mask = which layers do I collide with. I do not see why it isn’t working for your medium asteroids.

Tim Martin | 2020-09-27 16:08

:bust_in_silhouette: Reply From: deaton64

I managed to get it to work in your code. I had a similar issue once and it took me ages to find out what was wrong or what I think was wrong.

A couple of things first, I’d suggest that you name your collision layers, that way it’s easier to see what an object is colliding with.
You have large asteroid on layer 3 and the small and medium asteroids on levels 2 & 3. I’m guessing they all need to be on level 3.
The player mask is set to the same as itself, so I think the mask needs to 3, to collide with the asteroids.

Now the reason I think you are having issues, (this is a bit of a guess) is that you may have copied one of the asteroids to make the medium or big one and something in Godot doesn’t like it.
I deleted your middle asteroid and recreated it from scratch and added the script as a file and it works fine.

Here’s the code

thanks, but I created a new question and was helped.
Why medium asteroids collide with each other and collide with large asteroids - Archive - Godot Forum

Timofey | 2020-10-02 07:01