For a simple scheme, this is how i would do it:
Lets say x is the position of the player and r the radius.
If x is completely inside a box, move it in direction of the normal of the nearest plane until the distance to the plane is r. This should not happen usually.
Else find the nearest point p on each box and move x in direction p - x if norm(p-x) < r.
edit: see e.g. http://www.wildbunny.co.uk/blog/2011/04/20/collision-detection-for-dummies/ for more details on the subject.
Show differencesHistory of post edits
#1Inferiarum
Posted 14 August 2012 - 09:37 AM
For a simple scheme, this is how i would do it:
Lets say x is the position of the player and r the radius.
If x is completely inside a box, move it in direction of the normal of the nearest plane until the distance to the plane is r. This should not happen usually.
Else find the nearest point p on each box and move x in direction p - x if norm(p-x) < r.
Lets say x is the position of the player and r the radius.
If x is completely inside a box, move it in direction of the normal of the nearest plane until the distance to the plane is r. This should not happen usually.
Else find the nearest point p on each box and move x in direction p - x if norm(p-x) < r.