TransWikia.com

SAT Collisions: Resolving rotations

Game Development Asked by John Claire on November 9, 2021

Currently I have a working 2D SAT collision system with only boxes, but works with static rotations as well, leaving room for triangles. One of the issues I’ve been able to resolve was tunnelling, thanks to this thread‘s psuedocode that I got working for myself.

Problem is, this doesn’t support moving rotations like a system using a minimum-translation-vector. If I rotate alongside the side of an object, the system will fail even if I’m not moving.

My first thought in solving this was to use the longest line you can draw in a square (that being the points on either side of a square) and comparing the length of that to whatever side on any axis, but even squares have different sizes on any given rotation projected onto an axis.

The system also doesn’t work with multiple objects, because – while you can use the algorithm on a group of objects and find the shortest distance out of all of them – if I conserve my velocity relative to the colliding axis, diving into the crest of 2 objects means I will phase through one of them not beyond a 45 degree angle.

Is there an effective way to resolve collisions on rotations and groups of objects, while using this anti-tunnelling algorithm? I don’t care if it’s expensive, I’ll take whatever you can think of.

One Answer

I am not sure how you can use SAT to resolve continuous rotations but I know of two other algorithms that may do the trick, however they are made for convex shapes. The first one is conservative advancement(you can check out Erin Catto's presentation on youtube) this will give you the time of impact using translation and rotation and of course does take up some resources.

An other algorithm is GJK Raycast, it is less precise but takes up less resources. It can give you a lower time bound where you are sure that the objects will not be intersecting at that time bound. This algorithm is exact for translation, but for rotation you must "swipe" a sphere on your collider to encapsulate the rotation. Even though it's not precise it's still pretty decent. You can read more about this on Gino Van Bergen's papers(http://www.dtecta.com/papers/unpublished04raycast.pdf) or on his website (dtecta.com). However I once heard that it is impossible to resolve exactly continuous collision detection in real time, so yes it is possible but not in real time. I personally do static checks (GJK & EPA) for "slow objects" and I do a GJK raycast test for "fast" moving objects vs "slow" moving objects. It's not exact but it still gives decent results, the player/projectiles cannot go though walls anymore.

In the end I didn't really answer your question though, I haven't seen any papers on SAT continuous collision detection it probably is possible, although it might be just as complicated or maybe even more than the algorithms described above. Hope this helped at least a bit.

Answered by ThatGuyAgain on November 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP