Members - Reputation: 100
Posted 18 February 2012 - 03:20 AM
Main problematic colisions are:
As you can see i cannot sum all push vectors because my moving rectangle will be pushed too far away.
So that i'm getting 2 vectors from them which: has "best pushing" for x and for y value but counter to rect move vector.
But it doesnt works well too( I can find an example where it doesnt work ). Do you have any idea what should it do? Maybe i'm going bad way to get "push vector"? Any articles about getting this vector would be nice too.
Members - Reputation: 550
Posted 18 February 2012 - 05:08 AM
Your push directions are incorrect - the for rect vs rect the push directions are always either in the x or y axis only.
This article I wrote should give you some ideas, although not the complete answer: http://www.wildbunny.co.uk/blog/2011/04/20/collision-detection-for-dummies/
If you shrink one box A down to a point, and then increase the dimensions of the other box B by those of box A, the push vector can be found as the shortest distance from the point (box A) to the edges of box B.
Hope that helps!
Members - Reputation: 1867
Posted 18 February 2012 - 03:09 PM
A few links: