Issue with collision between moving and controlled sprite

Hi!

I have a weird issue with collisions.

playdate-20241016-155059

The jump ocurs at any time I try to move the player parallel to the colliding side (in the gif, I moved the player up).

The planet and the player have two simple collision boxes (apparently the debug collision bow drawing does not appear on the gif export :/) matching the sprite size.

The player movement is as follows

	local _x, _y  = self.x, self.y
	local _was_x, _was_y = _x, _y

	if playdate.buttonIsPressed(playdate.kButtonUp) then
		_y -= 1
	end

	if playdate.buttonIsPressed(playdate.kButtonDown) then
		_y += 1
	end

	if playdate.buttonIsPressed(playdate.kButtonLeft) then
		_x -= 1
	end

	if playdate.buttonIsPressed(playdate.kButtonRight) then
		_x += 1
	end

	local _a_x, _a_y, col, col_len = self:moveWithCollisions(_x, _y)

	if col_len > 0 then
		print("P", _was_x, _was_y, 'T', _x, _y, "R", _a_x, _a_y, "Diff", _a_x -_x, _a_y - _y)
	end

And the planet

    self.angle = (self.angle + self.speed * (2 * math.pi/playdate.getFPS())/60)

    self.angle = math.fmod(self.angle, 2 * math.pi)

    local x = self.cx  + self.h_radius * math.cos(self.angle)
    local y = self.cy + self.v_radius * math.sin(self.angle)

    x = playdate.math.lerp(self.x, x, 0.5)
    y = playdate.math.lerp(self.y, y, 0.5)

    self:moveWithCollisions(math.floor(x), math.floor(y))

Since the expectec behavior is that the planet never stops, it's collisionResponse is set to kCollisionTypeOverlap, letting the player get out of the way. I have try all collisionResponses for the player with the same behaviour.

I've been looking at the problem for a while and I just cannot see it.

Any clues? Thanks in advance!

It’s a bit hard to tell from what we’ve got here, but perhaps the issue is that you’re not resolving the collisions within your update loop? By overlapping the planet sprite after moving the player, it’ll enter the next update with overlapping sprites. Assuming you’re not moving the player it will do moveWithCollisions(0, 0) and resolve the collision in unexpected ways.
Just a hunch. Print some col[1] data to better understand what’s happening behind the scenes.

Sorry I forgot to follow up on the issue. Somebody from the Discord help me further debug the issue and it seems to be an SDK edge case.

Here is some more info:

playdate-20241017-093531

In this gif I'm plotting the colliding rectangles provided by moveWithCollisions when the ship moves one pixel down (y + 1)

Is the edge case caused by my explanation?