Good afternoon,
I've been experimenting a bit with Box2D (love.physics) today, everything is working as I expected, except for one problem, it seems that there's a little vague detail respect to the collision distance between a polygonShape and a chainShape, which becomes more notorious with smaller bodies and figures that collide.
Is it a normal problem of Box2D or is the way I make the drawing?
In case of being the second option, could this generate a problem of detection of collisions or positions?
Precision problems - Physics
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- AlexsSteel
- Prole
- Posts: 17
- Joined: Sat Dec 27, 2014 2:11 am
Precision problems - Physics
- Attachments
-
- test.love
- Code
- (1.68 KiB) Downloaded 91 times
Last edited by AlexsSteel on Sat Feb 14, 2015 12:16 am, edited 1 time in total.
Re: Precision problems - Physics
http://www.love2d.org/wiki/love.physics.setMeter
Experiment with meter size to suit your world. If you're going to use tiny coordinates you're going to need a tiny meter.
For example love.physics.setMeter(5) would work for the code you posted.
Experiment with meter size to suit your world. If you're going to use tiny coordinates you're going to need a tiny meter.
For example love.physics.setMeter(5) would work for the code you posted.
- AlexsSteel
- Prole
- Posts: 17
- Joined: Sat Dec 27, 2014 2:11 am
Re: Precision problems - Physics
Thanks, it worked.
Re: Precision problems - Physics
Box2D adds "padding" around polygon edges to improve stability.I've been experimenting a bit with Box2D (love.physics) today, everything is working as I expected, except for one problem, it seems that there's a little vague detail respect to the collision distance between a polygonShape and a chainShape, which becomes more notorious with smaller bodies and figures that collide.
Generally it's not visible for large objects, but on the smaller scale it becomes more apparent.
I would recommend drawing objects regardless of their size WITH the padding.
Keep in mind that changing the scale of objects changes the simulation in different ways.
Box2D works with meters not pixels, so an object that is 5x10 meters behaves differently than an object that is 50x100 meters.
This is in part because of "maxTranslation" and other constant that affect the simulation.
Who is online
Users browsing this forum: No registered users and 0 guests