Page 1 of 1

Windfield and collisions

Posted: Tue Feb 15, 2022 4:10 pm
by tehtehp
I'm currently using a physics module called windfield. I'm having trouble with collisions. Especially when two rectangle colliders are side by side on same surface. Player sometimes bumps into it as if it is a wall. Also collisions with wall when player is grounded is tricky. I wonder if there is a solution to this?

Code for creating colliders from Tiled:

Code: Select all

		for i, obj in pairs(self.level.layers["Platforms"].objects) do
			local platform = World:newRectangleCollider(obj.x, obj.y, obj.width, obj.height)
			platform:setType("static")
			platform:setCollisionClass("Platform")
       	 	end
Example: Player (red box) bumps between two colliders
Image

Re: Windfield and collisions

Posted: Tue Feb 15, 2022 5:08 pm
by darkfrei
Best collision function ever: https://love2d.org/wiki/BoundingBox.lua

Re: Windfield and collisions

Posted: Tue Feb 15, 2022 7:14 pm
by dusoft
darkfrei wrote: Tue Feb 15, 2022 5:08 pm Best collision function ever: https://love2d.org/wiki/BoundingBox.lua
Only for squares and rectangles, but indeed this is one of the simplest ones and it's pretty efficient.

Re: Windfield and collisions

Posted: Wed Feb 16, 2022 12:47 am
by veethree
This is a common issue. See here and here.