Page 1 of 1

Hardon collider Problem coming in dectectings collision properly

Posted: Fri Jan 26, 2024 12:27 pm
by Catzonic
So I was using Physics of HC (Hardon Collider) and I was trying to Checking sides of Tiles collider
The player object is getting inside the tile and the sides are not properly getting check
here is code for checking sides
its in Init.lua folder Physiclab

Code: Select all

 local collisions = HC.collisions(e)
        for other, separator_vector in pairs(collisions) do
            local cx,cy = e:center()
            cy = cy + 32
            cy = cy + (separator_vector.y * dt)
            cy = cx + 32
            cy = cx + (separator_vector.x * dt)
            local ocx,ocy = other:center()
        --    local newy = (ocy-32) -32
            e:move((separator_vector.x),(separator_vector.y))
          --  e:moveTo(cx,newy)
          
            if (separator_vector.y > 0.0) then
                self.Sides.top = true
                print('top')
            elseif  (separator_vector.y < 0.0)  then
                self.Sides.bottom = true
                print('bottom')
            elseif (separator_vector.x < 0.0) then
                self.Sides.left = true
                print('left')
                self.Sides.left = false
            elseif (separator_vector.x > 0.0) then
                self.Sides.right = true
                print('right')
            else
                self.Sides.top = false
                self.Sides.bottom = false
                self.Sides.left = false
                self.Sides.right= false
            end
        end
        
[
collisions_Problem.gif
collisions_Problem.gif (82.16 KiB) Viewed 2063 times
so What I have to do to solve this issue
PhysicsTest.love
(39.83 KiB) Downloaded 70 times

Re: Hardon collider Problem coming in dectectings collision properly

Posted: Fri Jan 26, 2024 1:22 pm
by dusoft
Sorry to bear bad news, but HC is pretty outdated. You can search forum for mentions, I also mention there using older version that was less buggy.

Re: Hardon collider Problem coming in dectectings collision properly

Posted: Sat Jan 27, 2024 3:09 am
by Catzonic
dusoft wrote: Fri Jan 26, 2024 1:22 pm Sorry to bear bad news, but HC is pretty outdated. You can search forum for mentions, I also mention there using older version that was less buggy.
Thanks to insure that I was looking for physics library what do you think which is the best

Re: Hardon collider Problem coming in dectectings collision properly

Posted: Sat Jan 27, 2024 10:55 am
by dusoft
Catzonic wrote: Sat Jan 27, 2024 3:09 am
dusoft wrote: Fri Jan 26, 2024 1:22 pm Sorry to bear bad news, but HC is pretty outdated. You can search forum for mentions, I also mention there using older version that was less buggy.
Thanks to insure that I was looking for physics library what do you think which is the best
Difficult to say. I tried them (probably) all - breezefield, windfield, HC. In the end I went with the native

Code: Select all

love.physics
module:
https://love2d.org/wiki/love.physics

It has a steep learning curve, but at least it was up to date. I see that breezefield still gets occasional updates, so you might try that. A couple years ago it looked abandoned.

Re: Hardon collider Problem coming in dectectings collision properly

Posted: Sun Jan 28, 2024 6:52 am
by Catzonic
dusoft wrote: Sat Jan 27, 2024 10:55 am
Catzonic wrote: Sat Jan 27, 2024 3:09 am
dusoft wrote: Fri Jan 26, 2024 1:22 pm Sorry to bear bad news, but HC is pretty outdated. You can search forum for mentions, I also mention there using older version that was less buggy.
Thanks to insure that I was looking for physics library what do you think which is the best
Difficult to say. I tried them (probably) all - breezefield, windfield, HC. In the end I went with the native

Code: Select all

love.physics
module:
https://love2d.org/wiki/love.physics

It has a steep learning curve, but at least it was up to date. I see that breezefield still gets occasional updates, so you might try that. A couple years ago it looked abandoned.
Thanks for the suggestion I was looking for physics library that is ligth weight as there I making a metroidvaina like Title as looking to bigger maps and muliple entites to mange Its needs to be simple
I looking in Bump.lua as well but its ligth weigth but its only have rect collision as I want for different shape hitboxs

Re: Hardon collider Problem coming in dectectings collision properly

Posted: Sun Jan 28, 2024 9:39 am
by dusoft
Yeah, forgot about Bump, but I hit the same issue - I needed to detect polygon collisions.

Re: Hardon collider Problem coming in dectectings collision properly

Posted: Tue Feb 06, 2024 9:15 pm
by Azzla
I still use HC for some of my projects, it works fine with the most recent version of love. Just ignore the official documentation because its woefully out of date.

The reason your rectangle is overlapping is because you need to swap the order of your move and update callbacks in love.update:

Code: Select all

function love.update(dt)
--R1:update(dt) --removed from here
if love.keyboard.isDown('left','a') then
  R1:move(-2,0)
end
if love.keyboard.isDown('right','d') then
  R1:move(2,0)
end
if love.keyboard.isDown('up','w') then
  R1:move(0,-2)
end
if love.keyboard.isDown('down','s') then
  R1:move(0,2)
end
R1:update(dt) --moved to here
end
Simulate the entity's movement first, then check for collisions and resolve the position vector accordingly. More advanced collision resolution usually means creating a "goal position" for an entity and then an "actual position" which is calculated after resolving all the various collision vectors.