Page 1 of 1

Joints and crashes

Posted: Tue Jan 07, 2014 1:16 am
by Simon6689
Whenever I try to delete a physics object I have, it worked fine and it deletes, but if the physics object has a mouse joint attached, it errors because the mouse joint was accessed, but it was destroyed and I have no way to check if it is destroyed or not. Furthermore, when I destroy an object with a weld joint attached, love crashes oughtright and windows shows the 'love.exe has stopped working' screen. I have tested the crash on 0.9.0 and nightly windows and my friend has tested it on 0.9.0 ubuntu.

Here is the code of the function that destroys objects. The caller passes the object to remove as self and each object gets it's own remove function so that

Code: Select all

if thing thing then
    objects[k].remove(k)
end
is possible in a for loop

here is function (also in for loop going through all objects):

Code: Select all

	v.remove = function(self)
		objects[self].body:destroy()
		objects[self] = nil
		table.remove(objects, tonumber(k))
	end
it's on line 158 of the main file.

here is .love file:

EDIT:

to cause the mouse joint error, hold onto the scientist and crash him into a wall really hard then wait a few seconds for him to fade out
to cause the weld joint crash, hit escape and enable weld mode, then resume and fling scientist into a wall really hard and wait a few seconds for him to fade out.

Re: Joints and crashes

Posted: Thu Jan 09, 2014 3:01 am
by Simon6689
hello?

Also, can you guys vote on some images for my game?
http://strawpoll.me/992861

Re: Joints and crashes

Posted: Thu Jan 09, 2014 4:35 am
by Simon6689
Nevermind, fixed it

Re: Joints and crashes

Posted: Thu Jan 09, 2014 4:41 am
by slime
What did you fix to get it to stop crashing?

Re: Joints and crashes

Posted: Thu Jan 09, 2014 6:13 am
by Simon6689
slime wrote:What did you fix to get it to stop crashing?
Instead of actually deleting the object, I am now doing

Code: Select all

objects[k].body:setActive(false)
objects[k].draw = nil
to make it invisible and disable it from colliding.

After that, the joints quietly disable themselves.

Re: Joints and crashes

Posted: Thu Jan 09, 2014 7:17 am
by bdjnk
Simon6689 wrote:hello?

Also, can you guys vote on some images for my game?
http://strawpoll.me/992861
Hi!
So, do you want a bunny, or a human-bunny hybrid? (bunnies don't usually crawl on their knees)
Anyway, I'm glad you got the issue resolved. Oh, also, love the avatar :)

Re: Joints and crashes

Posted: Thu Jan 09, 2014 3:29 pm
by Simon6689
This is for a school project, bunny 1 was voted out, so we are going with the more normal looking one.