There are a lot of SAT collision tutorials for various programming languages, but so few for Gamemaker it's astonishing. Right now the collision detection works, albeit only using boxes. However, resolving collisions has become a big hurdle. I've been wanting to use the psuedo code from this thread, but every implementation fails.

Here is the project file for you to run. On run, using the arrows keys and space bar you can move and rotate, and it will detect the other square

The only things you should be concerned about are the SAT and SATM scripts, and movement code. SAT is the code that only detects, while SATM is SAT with the collision resolving. Movement code is assigned to SAT, change it to SATM and add the returned array to the object origin to see it magestically not work. I've tried applying the speed vector before and after the collision code, but the results are still not in my favor.

The code is clunky with everything else, but it serves their purpose.

  • \$\begingroup\$ Folks will generally not download and run an untrusted project just to figure out what question is being asked. They'll just click on to the next question instead. I'd recommend editing your question to include the content of your SATM script, and a complete description (or screenshot / animated gif example) of how specifically it fails. Precisely-documented test cases, expected behaviour, and observed symptoms can be a huge help in tracking down the issue, helping you get more accurate answers, faster. \$\endgroup\$ – DMGregory May 7 '20 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy