Hello,
Writing your own collision system is an admirable attempt but it's hard and your code needs work.
For example, you need to use table.remove instead of:
for k,v in ipairs(collider.boxIDs) do
if v == newBox.ID then
v = nil
end
end
Request() takes your current movement incriments and your collider's ID and tests if that collider would be able to go there
Does this mean that you are simply checking if the future position is blocked or not? This would not work well with fast moving objects.
The "proper" way to do it is to find the shortest separation vector between the two intersecting shapes and move one of the shapes so that they no longer overlap.
I've made some tutorials in the past that you might find useful: https://2dengine.com/?p=intersections https://2dengine.com/?p=collisions
Good luck!
ivan wrote: ↑Sun Sep 01, 2019 6:30 am
The "proper" way to do it is to find the shortest separation vector between the two intersecting shapes and move one of the shapes so that they no longer overlap.
Thanks! I will try this out, as you said I did find some problems with fast moving objects. I wanted to try to see if I could create my own as a little challenge to myself. I'm very new to lua and love2d and mainly work in C# with Unity so I'm not very used to writing physics stuff as that's usually taken care of already in unity.