Hardon collider Problem coming in dectectings collision properly

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Catzonic
Prole
Posts: 5
Joined: Sat Feb 18, 2023 5:53 am
Contact:

Hardon collider Problem coming in dectectings collision properly

Post 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 1724 times
so What I have to do to solve this issue
PhysicsTest.love
(39.83 KiB) Downloaded 36 times
User avatar
dusoft
Party member
Posts: 510
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Hardon collider Problem coming in dectectings collision properly

Post 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.
User avatar
Catzonic
Prole
Posts: 5
Joined: Sat Feb 18, 2023 5:53 am
Contact:

Re: Hardon collider Problem coming in dectectings collision properly

Post 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
User avatar
dusoft
Party member
Posts: 510
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Hardon collider Problem coming in dectectings collision properly

Post 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.
User avatar
Catzonic
Prole
Posts: 5
Joined: Sat Feb 18, 2023 5:53 am
Contact:

Re: Hardon collider Problem coming in dectectings collision properly

Post 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
User avatar
dusoft
Party member
Posts: 510
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Hardon collider Problem coming in dectectings collision properly

Post by dusoft »

Yeah, forgot about Bump, but I hit the same issue - I needed to detect polygon collisions.
User avatar
Azzla
Prole
Posts: 38
Joined: Sun Mar 29, 2020 2:23 am

Re: Hardon collider Problem coming in dectectings collision properly

Post 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.
libraries: Stalkpile
electronic music stuff: https://soundcloud.com/azzlamusic
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 70 guests