jasonrobot / gamedev

Join me on my journey of learning to make video games!
GNU General Public License v2.0
0 stars 0 forks source link

Use physics (HC) and make things collide #11

Closed jasonrobot closed 8 years ago

jasonrobot commented 8 years ago

This will be a little tricky, but basically, make things collide and act as solids. HC should provide all the functionality needed.

jasonrobot commented 8 years ago

So the basic way to do this would probably just be to have the objects all moved back by the separating vector that HC provides. The problem with this is that non-actors would also be moved away (I guess?). Then, the simple answer to that problem is to keep track of whether the objects are actors or not, but that's a little more complexity and data than I want to take care of right now. There might be a better way.

jasonrobot commented 8 years ago

Got too used to closing issues. Reopened.

jasonrobot commented 8 years ago

The place that makes the most sense for this to go is in the object (since that has the HC shape). I was thinking we could check to see if the objects had any motion intents to see if they are the ones that should be corrected (they're dynamic). Static objects should never have motion intents.

jasonrobot commented 8 years ago

I'm assuming that collision detection & resolution in this game is going to basically be "stuff cant pass through other stuff" and that we don't really need any kind of actual physics.

jasonrobot commented 8 years ago

Ok, here's the deal: The gamestate is going to have to use the world that it has to check for collisions. If it finds any, there are two situations it might need to fix: Two dynamic objects colliding. One static and one dynamic object colliding

A simple way to take care of both types would be to just always call the collision handler in both objects and let them decide if they want to handle it or not.

What I'm not sure about is how to take a list of shapes that have collided and get their containing object to call the collision resolving code in there.

jasonrobot commented 8 years ago

This is implemented in #15