GML Bullet Collisions with Physics Enabled

Harper

Member
So I've been converting my game over so that it works with physics enabled, and I've my bullets working mostly properly but I'm not sure how to do overlapping collisions with Physics enabled. I'm thinking maybe each bullet could have collision_circle() with a very small radius, but I'm not sure if that's the right way to go about this.

TLDR; How do I check for bullet collisions with physics enabled?

Thanks!
 

DBenji

Member
Generally speaking, you can use traditional collision checking functions with the physics system (I wish the manual wasn't so silent on this matter) but you have to take into consideration that functions like place_meeting only check the collision mask of the object while physics_test_overlap will check for collisions between the fixtures making it only useful if your bullets also have fixtures attached.

This is important because if you have a wall physics object shaped like a box with a collision mask that appears to cover the same area and you scale it - the mask of the box and the fixture won't always align in a pixel perfect manner.

Also, trying to make the two systems interact with each other can get messy real quick depending on what you are trying to do but you can play it safe by either using traditional collision checking only as triggers for the physics objects or making all physics stuff purely cosmetic.
 
Top