Linear Sweep test for OBBs

Started by
2 comments, last by raigan 2 years, 9 months ago

Hey, I am trying to implement a way to do a linear sweep test against OBBs. I don't even know if I should go for SAT or GJK. I have already succesfully implemented static tests using SAT, but I am struggling on

  1. Getting usefull informations out of it (like penetration, normal etc…), currently only having one boolean
  2. Doing sweep test instead of static one

Could anyone one help me / link me some ressources, I would really appreciate ?

Also I am on 2D, I don't worry about angular velocity, and the test will be Moving vs Static, not Moving vs Moving

Thanks in advance !

Advertisement

About (1), for objects that only translate, it's easy: SAT gives you a 1D signed distance along each axis you test. If any distances are positive, the shapes are separated and you're done. Otherwise, the smallest negative distance (minimum absolute value of the distance) is the penetration, and the axis associated with that distance is the normal.

If this is for a physics simulation, you need a contact manifold. IIRC you can generate one by clipping the shapes, once you know they're overlapping.

See:

https://www.gamedev.net/forums/topic.asp?topic_id=453179

https://box2d.org/files/ErinCatto_ContactManifolds_GDC2007.pdf

http://media.steampowered.com/apps/valve/2015/DirkGregorius_Contacts.pdf

you could also try browsing the box2D source code, which should have code that performs such clipping for convex polygons.

About (2), I think this should be as easy as adding the velocity/sweep vector when calculating the signed distances (ie project the velocity vector onto the axis, and sum that with the sum of the projections of the two shapes (ie the usual SAT stuff)).

However, it's been a while so I'm not 100% sure about that. Maybe you also need to test an additional axis? (The velocity vector's axis.)

I'm having a hard time googling for related stuff! (eg linear shape cast sweep)

About (2), look at section 6 of this: https://www.geometrictools.com/Documentation/MethodOfSeparatingAxes.pdf

This topic is closed to new replies.

Advertisement