im trying to do "proper" collision detection / response.
im trying to use the penetration depth of two axis aligned rectanges to move the player out of it.
it works okey, in the fact that the player is no longer in the other object.
but it is not working in the fact of gameplay.
ive searched and read a lot of posts about collision detection / response but i cannot get what i want done( it keeps doing what i told it and not what i wanted to happen )
this is a picture of the result.
how should i do the penetration processing so that it will push the player up / left without this problem ?
here is the code that does the collision penetration:
if( left < other_right ) penetration.x = left - other_right; else if( right > other_left ) penetration.x = other_left - right; if( bottom > other_top ) penetration.y = other_top - bottom; else if( top > other_bottom ) penetration.y = top - other_bottom;
Thanks In Advance.
i proberbly should mention that im adding the result ( "penetration" ) to the player position.