Legacy GM Are the MASK and Bounding Boxes different things?

Dr_Nomz

Member
I'm learning to use collision_line and I noticed that my objects are colliding with the bounding box of the sprite, even though it has a specific mask set for it. Why is that? Can I change the behavior of it?

EDIT: Just looked into it a bit more, I have another question: What exactly does the precise collision checking do for sprites?
 

obscene

Member
From the manual... If set to true, then precise collisions are to be calculated (but only if the object being checked for has "precise" marked for its collision detection in its mask properties) which is a slightly more complex task for the CPU and so should be used with caution. If false then collisions will be calculated based on the bounding box of the object to be checked for.
 

TheouAegis

Member
Precise Collision Checking is essentially what it sounds like. GM checks every opaque pixel in the sprite for a collision with the specified object/instance. Naturally, the larger the sprite, the longer the check will take. Using precise collisions means GM won't be allowed to optimize collision checks, so your performance will take a major hit.
 

Joe Ellis

Member
I think collision_line only detects collision with the bounding boxes.
And for precise collision, I think any sprite mask using precise collision has a grid generated for them, basically a grid of solid or non solid per pixel, which isn't too slow if the other object has a non precise mask, but I remember 2 precise instances colliding was really slow, and caused the game to lag with about 20 instances.
 

Dr_Nomz

Member
So basically the sprite's mask does nothing at all? If that's the case how do I change the bounding box? And why is it even separate? Wouldn't it have been better to leave the bounding box controlled by the sprite?
 
The mask does a lot. The bounding box is based on the sprite mask. That way you can have a complex sprite, but make a simple box mask shape to speed up collisions, and for most games this is sufficient.

If your collisions are set to precise, then GameMaker uses the mask and checks every pixel on it against other sprites if they are also set to precise.
 

Dr_Nomz

Member
oh okay. I thought if I set the mask to a circle (not precise) that it would account for the new, round Bounding Box, even with "precise" collision turned off, but I see that's not the case. :/ Thanks!
 
Top