Page 1 of 1

Physics objects not quite touching

Posted: Tue Jan 24, 2023 11:50 am
by Bobble68
Hi all! I've been using Love's physics engine for my game, however I've noticed that fixtures seem to be slightly bigger than they should be, causing there to be small gaps between them, and I'm not sure what's causing it. I know this can be fixed by just reducing the fixtures' size relative to the textures to compensate, though I don't want to do this if I don't have to. Anyone know what's happening?

Untitled.png
Untitled.png (138.84 KiB) Viewed 2909 times

The circle and the red lines show where the fixtures should be.

Re: Physics objects not quite touching

Posted: Tue Jan 24, 2023 12:21 pm
by Bigfoot71
What type of collision are you using? Do you scale the textures? The problem does not come from the scale of the world? If you can try to reproduce the same problem as in your game in a small script and share it, we can better guide you because the causes can be multiple. Maybe someone else who has had the same problem as you can tell more.

Re: Physics objects not quite touching

Posted: Tue Jan 24, 2023 3:14 pm
by pgimeno
My bet would be on inappropriate setting of love.physics.setMeter().
It is recommended to create shapes no larger than 10 times the scale. This is important because Box2D is tuned to work well with shape sizes from 0.1 to 10 meters. The default meter scale is 30.
https://love2d.org/wiki/love.physics.setMeter

Re: Physics objects not quite touching

Posted: Thu Jan 26, 2023 11:53 am
by Bobble68
pgimeno wrote: Tue Jan 24, 2023 3:14 pm My bet would be on inappropriate setting of love.physics.setMeter().
It is recommended to create shapes no larger than 10 times the scale. This is important because Box2D is tuned to work well with shape sizes from 0.1 to 10 meters. The default meter scale is 30.
https://love2d.org/wiki/love.physics.setMeter
Ah it does seem to be affected by changing it - I'm not sure if I'm going to bother to try fix it, it'll be too much of a pain to try and fix the other elements to fit it. Does anyone know if there's a way to change it without affecting all of the force and speed values?

Re: Physics objects not quite touching

Posted: Thu Jan 26, 2023 2:20 pm
by Bigfoot71
Bobble68 wrote: Thu Jan 26, 2023 11:53 am Ah it does seem to be affected by changing it - I'm not sure if I'm going to bother to try fix it, it'll be too much of a pain to try and fix the other elements to fit it. Does anyone know if there's a way to change it without affecting all of the force and speed values?
Unfortunately if you change the "scale" of the world I think that you will have to review these values.