Ok I reproduced it in a simple scenario, but this time it's a bit more tricky (love attached):
Code: Select all
local bump = require "bump"
--
local world
local player = { name = "Player", x = -637.98029097876, y = 121.258009477, width = 45, height = 230 }
local wall = { name = "Top", x = -1231.0972683545, y = -4.7101051668953, width = 704.33784991272, height = 24.527806378436 }
local wall2 = { name = "Wall", x = -836.50049554579, y = 9.28935041878, width = 198.12839196213, height = 406.74931778108 }
local wall3 = { name = "Ground", x = -720.03530808969, y = 351.258009477, width = 825.61876233948, height = 147.22597405042 }
local step = 1
--
-- LOVE callbacks
--
function love.load(arg)
world = bump.newWorld()
world:add(player, player.x, player.y, player.width, player.height)
world:add(wall, wall.x, wall.y, wall.width, wall.height)
world:add(wall2, wall2.x, wall2.y, wall2.width, wall2.height)
world:add(wall3, wall3.x, wall3.y, wall3.width, wall3.height)
end
function love.draw()
love.graphics.translate(800, 200)
love.graphics.scale(0.5, 0.5)
love.graphics.setColor({ 0, 255, 0, 150 })
love.graphics.rectangle("fill", player.x, player.y, player.width, player.height)
love.graphics.setColor({ 255, 0, 0, 150 })
love.graphics.rectangle("fill", wall.x, wall.y, wall.width, wall.height)
love.graphics.rectangle("fill", wall2.x, wall2.y, wall2.width, wall2.height)
love.graphics.rectangle("fill", wall3.x, wall3.y, wall3.width, wall3.height)
end
function love.update(dt)
end
function love.keypressed(key)
if key == " " then
if step == 1 then
-- Move 1
local actualX, actualY, cols, len = world:move(player, player.x - 10, player.y + 10)
player.x = actualX
player.y = actualY
print("actualX="..actualX..", actualY="..actualY)
print("colliding with:")
for _, col in ipairs(cols) do
print(col.other.name)
end
step = step + 1
elseif step == 2 then
-- Move 2
local actualX, actualY, cols, len = world:move(player, player.x, player.y + 10)
player.x = actualX
player.y = actualY
print("actualX="..actualX..", actualY="..actualY)
print("colliding with:")
for _, col in ipairs(cols) do
print(col.other.name)
end
step = step + 1
end
end
end
So it occurs after 2 steps (press "space" on the test application to apply each step). At the first one, I try to move against the wall, bump returns me a correct position and I update the player with it, everything is normal. On the second step, I don't move on the x axis (I just collided a wall so my velocity is reseted to 0), I just make a gravity check that I'm actually always doing (I removed it on my first test scenario as the issue was occuring even without it, but this time it's required), and bump returns that it collides with the platform on top of me (and not the one I'm standing on) and moves me on top of it.
Is the issue coming from the fist collision check giving me a position which is still colliding with the wall? As for the second check I don't move on the x axis but I still collide with it, is it normal?
Cheers,