Collision Confusion

The spybot  project is currently using GameMaker’s physics to handle gravity and collision. The bot can move and collide with walls just fine.

Then I need to make the bot climb on walls and cling to ceiling. So I use this function to check if the bot touches any wall:

place_meeting(x, y, obj)

To my confusion, the function said that the bot already touched both left and right walls when it was standing on the ground.

Few hours later I found out that physics’ and sprite’s collision detections are separate things. And in my case, the physics’ collision area is smaller than the sprite’s by 8 pixels.

While the engine uses physics’ collision area to stop the bot from falling through the ground, the function uses sprite’s collision area to detect any collision. So basically the sprite’s collision detection said that the bot sunk to the ground.

I Fixed the collision areas, and now I can start on some climbing logic.

Leave a comment