Page 1 of 1

Physics Collision Oopsies

Posted: Sat Nov 02, 2013 12:31 pm
by wansa!
Hey guys :awesome:

I've been using Love2D for a year or so, and I really love it :crazy: especially the love.physics module, which is a lot easier than Box2D (which I also tried out).
I haven't found it a ten tonne hammer like the Wiki states, although this one thing is bothering me.

I'm developing a physics-orientated sandbox game (sorry, no .love file... want to keep it closed source for the time being) and I've just made an explosion section thanks to iForce2D (the tutorial can be found here: http://www.iforce2d.net/b2dtut/explosions) and his particle concept.

So I've created some static structures here
DsiQzt6.png
DsiQzt6.png (205.17 KiB) Viewed 200 times
and then I'm putting a bomb in the middle. (Those lines are the paths that the 128 explosion particles have followed.)
5DXaf36.png
5DXaf36.png (28.96 KiB) Viewed 200 times
Now this is where it starts being suck.
The past two images I have captured while updating world slower than delta time (

Code: Select all

world:update(dt*timescale) --where timescale is less that 1
If I restore timescale to 1 and then pause it a fraction of a second later, this is what I get.
dn8X69G.png
dn8X69G.png (100.4 KiB) Viewed 200 times
y u do dis

It seems as though the computer has made a sudden rush to calculate the trajectories, and then let seven particles slip through the roof. :ehem:
But if I play the whole thing out in slow motion, the particles stay put and don't get quantumly entangled :shock:

Is there a convar or something that allows the computer to use more resources and thereby calculate things more accurately to not produce these kinds of errors, or is this a glitch in Box2D or Love or My Computer or the Matrix?

Many thanks :nyu:

Re: Physics Collision Oopsies

Posted: Sat Nov 02, 2013 1:32 pm
by Nixola

Code: Select all

local fractions = 2
for i = 1, fractions do
  world:update(dt/fractions)
end
This should solve the issue; if it doesn't try to increase fractions, but beware: it gains precision, but it's heavier

Re: Physics Collision Oopsies

Posted: Sat Nov 02, 2013 3:44 pm
by bartbes
Have you tried setting the particles to bullets?

Re: Physics Collision Oopsies

Posted: Sat Nov 02, 2013 4:01 pm
by kikito
bartbes wrote:Have you tried setting the particles to bullets?
Bartbes means using [wiki]Body:setBullet[/wiki](true) on the yellow particles, in case that was not clear.