Page 1 of 1

Collision with Bump

Posted: Tue Nov 29, 2022 1:54 pm
by fridays18
Ive been trying to use Bump.lua lib and I understand just about everything except how collision works, ive looked through the forums and the docs and cant find anything helpful, its all a bit confusing so if someone could explain it id appreciate it :)

NOTE: I know how to setup the world, add collision boxs, and update the collision just not how it actually works all together

Re: Collision with Bump

Posted: Tue Nov 29, 2022 2:42 pm
by fridays18
Another note: Im using bump since ive heard it works well but if anyone has any alternative collision methods that might work better I would be happy to know:)

Re: Collision with Bump

Posted: Tue Nov 29, 2022 2:51 pm
by darkfrei
I've never used this lib but but found it here:
https://github.com/kikito/bump.lua#collision-resolution

Code: Select all

function movePlayer(player, dt)
  local goalX, goalY = player.x + player.vx * dt, player.y + player.vy * dt
  local actualX, actualY, cols, len = world:move(player, goalX, goalY)
  player.x, player.y = actualX, actualY
  -- deal with the collisions
  for i=1,len do
    print('collided with ' .. tostring(cols[i].other))
  end
end

Re: Collision with Bump

Posted: Tue Nov 29, 2022 3:19 pm
by fridays18
darkfrei wrote: Tue Nov 29, 2022 2:51 pm I've never used this lib but but found it here:
https://github.com/kikito/bump.lua#collision-resolution

Code: Select all

function movePlayer(player, dt)
  local goalX, goalY = player.x + player.vx * dt, player.y + player.vy * dt
  local actualX, actualY, cols, len = world:move(player, goalX, goalY)
  player.x, player.y = actualX, actualY
  -- deal with the collisions
  for i=1,len do
    print('collided with ' .. tostring(cols[i].other))
  end
end
Yeah i alr saw that and I cant really understand whats happening lol

Re: Collision with Bump

Posted: Tue Nov 29, 2022 7:21 pm
by pgimeno
Bump is probably not the right tool for this job: viewtopic.php?p=184943#p184943

Re: Collision with Bump

Posted: Tue Nov 29, 2022 8:15 pm
by fridays18
pgimeno wrote: Tue Nov 29, 2022 7:21 pm Bump is probably not the right tool for this job: viewtopic.php?p=184943#p184943
Do you know of any other alternatives?

Re: Collision with Bump

Posted: Tue Nov 29, 2022 8:38 pm
by pgimeno
fridays18 wrote: Tue Nov 29, 2022 8:15 pm Do you know of any other alternatives?
Do your own physics, or try HC.