Physics Collision Oopsies

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
wansa!
Prole
Posts: 3
Joined: Fri May 31, 2013 12:31 pm

Physics Collision Oopsies

Post 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 196 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 196 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 196 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:
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Physics Collision Oopsies

Post 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
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Physics Collision Oopsies

Post by bartbes »

Have you tried setting the particles to bullets?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Physics Collision Oopsies

Post 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.
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 4 guests