Weird collisions reaction


Hi :wave:

I have a weird issue with SDK's (Windows, 1.12.3) collisions :

  • The white rectangle is moving up constantly
  • But, when I'm moving the black rectangle down, nothing weird happen, but if I move it up, and I go a little too fast (very little), the white rectangle clip through the black rectangle, awaited reaction : The white rectangle stay at the top of the black rectangle

My code :

-- self.vy is initialized to 0 in the WhiteRectangleSprite:init() function
function WhiteRectangleSprite:update()
    self.vy -= 0.01 -- Gravity
    self.vy = Math.clamp(self.vy, -5, 25)

    local actualX, actualY, collisions, length = self:moveWithCollisions(self.x, self.y + self.vy)

and for the Black Rectangle, I'm just using :

function playdate.cranked(change, acceleratedChange)
    blackRectangle:moveBy(0, change)

The issue GIF :

Thank you for your help and have a great day :slight_smile:


If you do WhiteRectangleSprite:move and blackRectangle:moveWithCollisions, does it work as you expect?

(Sorry, I’m finding it a bit hard to visualise what you’re trying to do here, but maybe blackRectangle:move is putting blackRectangle above WhiteRectangleSprite).

1 Like

If you do WhiteRectangleSprite:move and blackRectangle:moveWithCollisions , does it work as you expect?

I tried, it's "working", but black rectangle can't push white rectangle anymore

Sorry, I’m finding it a bit hard to visualise what you’re trying to do here

Yeah, I know, I'm sorry, I just made it simpler, but here it is what I want to do :

  • The White Rectangle will have gravity, but can be pushed by the black rectangle, but I want the black rectangle to like "push the white rectangle in the air" (Bouncy felling)

I think I found the issue :

  • When using :moveBy, the black rectangle can overlap the white one. So, when the white rectangle try to update his position, it just stress, and go under the black rectangle

Thank for your help, I'll update the post if it's working

(Sorry if you don't understand well what I try to say, English isn't my main language)

1 Like

I tried everything I could, and still not working... Maybe it's not possible
I'm just going to remove it and find another idea...

Thanks for the help !


1 Like

I'm noticing the collision errors occur when the moving black rectangle breaks the lower plane of the other two stationary ones. Is is possible there is a collision/geometry overlap with all three black rectangles together? Are the stationary black rectangles part of collision geometry? If so, possibly space them outward or otherwise ensure there cannot be a negative or divide-by-zero clearance.

Good luck!


Thanks for your answer,

I tried but sadly, still not working...
I'll just make another gameplay / idea !

Have a great day !

1 Like