• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

So just curious...

B

bojack29

Guest
When using collision_circle you'll notice the argument of precision in the function. What on earth is the purpose of that? I understand that it is used to look for objects whom also have precision masking but why is that necessary? Why doesn't the function just catch all objects that use precision masking or not? Seems a little silly for the need to check the collision function as well.
 

obscene

Member
Precise: Is any pixel of the object inside the circle.
Not Precise: Does the bounding box of the object intersect the circle.
 
B

bojack29

Guest
The circle works either way. I dont think your understanding. My thinking is that the circle should pick up collisions whether the object has a precise mask or not. For it to also pick up precise masks you have to leave the argument true. This seems odd to me. Is it a redundant check that makes the function faster not searching for precise masks? Ive always wondered...
 
A

anomalous

Guest
I don't get what you mean either bojack29.

When you use two instance masks that check collision between each other, to get precise collisions both have to be set to precise.
When you use a geometric collision check vs an instance masks, the geometric collision doesn't have a sprite editor...so you have to enter precise or not, as an argument. You are correct that the circle/geometric side of the check remains the same either way. It's that colliding instance that could be bounding box or precise.
 

obscene

Member
If precise is not enabled (in the collision function), your circle is looking for the rectangle around and object. It doesnt matter if your object has a precise mask. GM don't care. Because you told it not to.

Just because you clicked precise on the sprite doesn't mean GM automatically does precise checking. It just means you have the option now.
 

Zodaris

Member
Example: (my example uses collision_line, but they both have that same aspect)
You have precise set to false. You have mechanical sliding doors (which have a precise mask). You also have a laser aimed at the doors that is always on. The door animation plays for it to open out of the way, but the laser will never go through, even though there isn't anything there.
Once you switch precise on for the collision function, the laser will see that nothing is there and will go through as soon as the door opens out of the way.

(Had to figure this out for my game. Had quite the headache until I figured it out.)
 
B

bojack29

Guest
Hm. Just seems weird. Its like you could just tick the argument true and call it a day. Anyone looking at this at face value would assume a collision circle would naturally find and respect precise masks around it.

Its probably a performance check. Maybe GM just makes life easy for itself by JUST checking for bounding boxes, or if the argument rings true it will ALSO look for precise masks.

Idk, I just find it odd.
 
Last edited by a moderator:

obscene

Member
Anyone looking at this at face value would assume a collision circle would naturally find and respect precise masks around it.
It does. You're not telling it "only find precise objects" by putting in a 0. You're telling it "if a precise object is in the circle, just look for it's bbox instead."
 
B

bojack29

Guest
@obscene
Thats what I figured. The argument is a little confusing for someone looking at it from the outside in.

I understand thats what collision circles do and thats how the argument works. But it is almost as if you could omit that argument entirely and everything would work exactly as you'd expect.
 
P

Pieps

Guest
@obscene
Thats what I figured. The argument is a little confusing for someone looking at it from the outside in.

I understand thats what collision circles do and thats how the argument works. But it is almost as if you could omit that argument entirely and everything would work exactly as you'd expect.
You already pretty much ostensibly proved you know how it works. The real difference is that pixel perfect masking is more CPU intensive, which can be dangerous depending on the frequency of which the function is invoked.
 
Top