• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code Precise Collision Problem

T

ThewDev

Guest
I'm having trouble getting precise collisions to interact with other collisions at all. I know that mixed collisions are supposed to fall back to bounding box collisions, but that doesn't seem to happen either.

I did two identical tests - one in GM:S and one in GMS2:

Made two objects - one with precise collisions and one with a rectangle collider

Used place_meeting to generate a debug message indicating the collision when they overlapped

In GM:S collisions were detected immediately and accurately. But in GMS2 no collision was detected at all.

Is this a bug? Or am I not understanding some change in the functionality?
 
T

ThewDev

Guest
The only code pertinent to this is the one collision function:

if (place_meeting(x, y, Collider))
show_debug_message("collision!");
It works with two rect colliders, but not one rect and one precise
 
T

ThewDev

Guest
I only tested it in the step event, but I'll definitely try a collision event when I get home.

Because of the structure and complexity of my movement code, this wouldn't be a good solution, but it will be interesting to see if that fixes it. Thanks!
 
T

ThewDev

Guest
Okay, so the collisions do work when using a collision event specifically, but it's a bounding box collision and isn't precise (but I guess the documentation states that this is intended). That still doesn't explain why the collisions aren't working when using place_meeting()

Possibly a bug?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
I have made my own test of this in 2.0 and it seems to be working fine... Here's my test project if you want to look at it.

http://www.filedropper.com/collisions

One instance has a precise mask and the other a bbox mask and collisions are showing just fine.
 
T

ThewDev

Guest
Wow, thank you for taking the time to make that! After bashing my head against this problem for another hour, I believe I figured out the problem. It seems like the alpha tolerance on the sprites was set too high (and my colliders are partially transparent). What confused me was that the collision masks were appearing correctly on the sprite editor so I assumed they were okay.

Thanks a lot for your help!
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Hmm. If that is indeed the case then it should probably be filed as a bug. If the collision mask is being drawn in the editor, one would expect that collisions should register, and if they don't then it sounds to me like something needs fixing. If you could take a moment to export a YYZ project file and post a bug with it explaining the issue, I'd appreciate it.
 
Top