Physics objects not quite touching

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Bobble68
Party member
Posts: 155
Joined: Wed Nov 30, 2022 9:16 pm
Contact:

Physics objects not quite touching

Post 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 2515 times

The circle and the red lines show where the fixtures should be.
Dragon
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: Physics objects not quite touching

Post 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.
My avatar code for the curious :D V1, V2, V3.
User avatar
pgimeno
Party member
Posts: 3541
Joined: Sun Oct 18, 2015 2:58 pm

Re: Physics objects not quite touching

Post 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
User avatar
Bobble68
Party member
Posts: 155
Joined: Wed Nov 30, 2022 9:16 pm
Contact:

Re: Physics objects not quite touching

Post 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?
Dragon
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: Physics objects not quite touching

Post 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.
My avatar code for the curious :D V1, V2, V3.
Post Reply

Who is online

Users browsing this forum: slime and 13 guests