Page 2 of 2
Re: SAT with concave/complex polygon for collision response
Posted: Thu Apr 13, 2023 10:28 pm
by dusoft
Also check this library:
https://github.com/Aweptimum/Strike
It supports both Convex and Concave polygons.
Re: SAT with concave/complex polygon for collision response
Posted: Sat Apr 15, 2023 10:12 am
by Bigfoot71
Thanks for the suggestion, I'll take a closer look
Re: SAT with concave/complex polygon for collision response
Posted: Sat Apr 15, 2023 3:54 pm
by dusoft
Bigfoot71 wrote: ↑Sat Apr 15, 2023 10:12 am
Thanks for the suggestion, I'll take a closer look
Sure, let us know. I have tested it with convex polygons, it works well. But I haven't tested it with concave polygons.
Re: SAT with concave/complex polygon for collision response
Posted: Sat Apr 15, 2023 10:47 pm
by Bigfoot71
Well, finally, it's interesting and it reassures me while also worrying me in a way. There are exactly the same problems in this library as in mine. Here's a picture:
As a reminder, with my module using the latest test to date, knowing that I have made more convincing ones but still similar (
the numbers scrolling in the terminal are precisely the number of collision triangles detected before repositioning):
Here's the code I used with Strike:
Code: Select all
local S = require("strike")
local pm = require("polyman")
local p1 = pm.create.random(0, 0, 8, 128)
local p2 = pm.create.random(0, 0, 8, 128)
pm.setReverse(p1)
pm.setReverse(p2)
p1 = S.trikers.Concave(unpack(p1))
p2 = S.trikers.Concave(unpack(p2))
p2:translateTo(
love.graphics.getWidth()/2,
love.graphics.getHeight()/2
)
function love.update(dt)
local mx, my = love.mouse.getPosition()
p1:translateTo(mx,my)
local t = S.triking(p1, p2)
if t then p1:translate(t.x,t.y) end
end
function love.draw()
p1:draw()
p2:draw()
end
Re: SAT with concave/complex polygon for collision response
Posted: Sun Apr 16, 2023 8:02 am
by darkfrei
It looks like that every point must have a list of values, bool value to present if this point is inside of each triangle and it cannot be changed while movement.