February 13, 2010

So, here’s the outcome of the past few days working on collision detection and response. In games, usually the player is not trying to go through the wall, it’s most likely a touch by mistake, meaning he’s pressing two directional keys at the same moment. Zeroing the velocity towards the wall direction and leaving the rest intact allows for smooth gameplay. Jumping onto the platforms was also quite tricky as you have to compare the height of the player and the platform to determine if the player is on top of it so you cancel only the velocity at the Y axis preventing the player from sinking into the platform. Then leaving the XZ axes intact despite the collision allows for walking on them.

  1. mesartian posted this