Fixture Destroy 0.8.0
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Fixture Destroy 0.8.0
Creating a fixture and then immediately destroying it seems to cause love to crash during the subsequent call to World:update.
Re: Fixture Destroy 0.8.0
I don't see it crashing with something simple like this.
Do you create the Fixture in a callback? Box2D assumes that you do not alter the physics world during the timestep and may throw (currently uncaught) exceptions or crash horribly. Adding new bodies and fixtures should be done after the timestep. The destruction of objects is queued by LÖVE as a convenience, but I recommend to do it after the timestep as well because it might make debugging more difficult.
Code: Select all
local step = 1 / 60
W = love.physics.newWorld(0, 1000)
W:update(step)
B = love.physics.newBody(W, 400, 0, "dynamic")
S = love.physics.newCircleShape(10)
F = love.physics.newFixture(B, S, 1)
W:update(step)
W:update(step)
W:update(step)
B2 = love.physics.newBody(W, 400, 0, "dynamic")
S2 = love.physics.newCircleShape(10)
F2 = love.physics.newFixture(B2, S2, 1)
F2:destroy()
W:update(step)
B2:destroy()
W:update(step)
W:update(step)
W:destroy()
Shallow indentations.
Re: Fixture Destroy 0.8.0
thanks for the response. i probably should have stated that i am using coroutines. i have included an example.
Code: Select all
function love.load()
w = love.physics.newWorld(0, 1000)
end
function love.update(dt)
b = love.physics.newBody(w, 400, 0, "dynamic")
s = love.physics.newCircleShape(10)
co = coroutine.create(function()
while true do
f = love.physics.newFixture(b, s, 1)
f:setFilterData(1,65535,-1)
coroutine.yield()
end
end)
coroutine.resume(co)
coroutine.resume(co)
f:destroy()
w:update(dt)
end
Re: Fixture Destroy 0.8.0
Aha. It's not the coroutines, but an actual bug in Box2D. setFilterData will refilter the contacts and the destroy call doesn't remove all proxies properly. I don't think you can do anything about it from the Lua side.
Shallow indentations.
Re: Fixture Destroy 0.8.0
you are correct it is not the coroutine. well thanks for the help.
Who is online
Users browsing this forum: Bing [Bot] and 5 guests