Hardon collider Problem coming in dectectings collision properly
Posted: Fri Jan 26, 2024 12:27 pm
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
[
so What I have to do to solve this issue
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