Archived

This topic is now archived and is closed to further replies.

Mark Duffill

OBB<->Triangle Push Vector

Recommended Posts

HI, I have Object orientated Bounding Boxes and triangle collision detection implmented, however i seem to be having problems on resolving the "Delta Push" vector. This vector is used to move the object (OBB) so it is not inter-penetrating the intersecting trangle. For a sphere this is simply the vector from the Triangle hit point (HP) to the centre of the sphere multiplied by the penetration distance. But with an OBB it is more difficult, for instance hitting a railing face on may produce a back and downwards force when it should be back only.
  
   |-------|  Wrong, should be  |-------|
  O|\      |                    O--->   |
   | \     |                    |       |
   |   x   |                    |   x   |
   |       |
   |       |    O Railing , looking along
   |-------|    x centre of box
  
Now i could try and use the triangles normal, but if the triangle is edge on, or at an angle, ( A slope for example ) this will not work. i tried also selecting the most approprate box axis, using the x,y,z intersection distance, but this fails for certain conditions when the triangle is quite far inside, or the same distant on 2 or more axis. Any ideas? Dmmn my crap maths! [BTW: resources on the internet seem only either to report t/f intersection or the hit point, none seem to show how to get the Delta Push.]

Share this post


Link to post
Share on other sites
I think you''re problem lies in how you detect collision. If you are using bounding boxes then you can either use a form of continous collision detection (much slower and not well suited for games) or you have to make an educated guess which face is most likely the colliding face. A simple method to decide is to calculate the distance from each face and use the smallest one as the colliding face. From there, you just generate your delta push vector. This isn''t prefect, but it will work very well as long as your time steps are small. (they should be in a game)

Share this post


Link to post
Share on other sites