slinga
Established Member
Hi all,
I'm chugging along on my contest entry and I'm still stuck on how to do 2d collision detection with multiple objects. My game objects include players (1-12), enemies (0-10?), obstacles (0-5?), and ground (1-10?). All objects are using rectangular bounding boxes.I have AABB collision detection implemented for my objects.
I'm struggling with some of the more advanced stuff:
- how do I handle collision detection with two moving objects?
- what happens if two objects pass each other in a frame and are no longer hitting?
- how do I determine which direction the objects hit each other from? Sounds easy but if the objects pass through each other it's harder
I'm also not clear on how my gameplay loop should look like. Assuming I have 3 functions input(), updateState(), and draw() called per gameplay frame. Do I read inputs from all players first before calling updating? Do I check input and update each object at a time?
Reyme mentioned SweeptAABB which looks interesting but appears that it's designed for the case one object is moving and the other is stationary. I can implement that for object vs ground collisions.
I'm chugging along on my contest entry and I'm still stuck on how to do 2d collision detection with multiple objects. My game objects include players (1-12), enemies (0-10?), obstacles (0-5?), and ground (1-10?). All objects are using rectangular bounding boxes.I have AABB collision detection implemented for my objects.
I'm struggling with some of the more advanced stuff:
- how do I handle collision detection with two moving objects?
- what happens if two objects pass each other in a frame and are no longer hitting?
- how do I determine which direction the objects hit each other from? Sounds easy but if the objects pass through each other it's harder
I'm also not clear on how my gameplay loop should look like. Assuming I have 3 functions input(), updateState(), and draw() called per gameplay frame. Do I read inputs from all players first before calling updating? Do I check input and update each object at a time?
Reyme mentioned SweeptAABB which looks interesting but appears that it's designed for the case one object is moving and the other is stationary. I can implement that for object vs ground collisions.