Joints and crashes

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
User avatar
Simon6689
Prole
Posts: 7
Joined: Tue Jan 07, 2014 12:41 am

Joints and crashes

Post 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.
Attachments
Game.love
(1.25 MiB) Downloaded 78 times
User avatar
Simon6689
Prole
Posts: 7
Joined: Tue Jan 07, 2014 12:41 am

Re: Joints and crashes

Post by Simon6689 »

hello?

Also, can you guys vote on some images for my game?
http://strawpoll.me/992861
User avatar
Simon6689
Prole
Posts: 7
Joined: Tue Jan 07, 2014 12:41 am

Re: Joints and crashes

Post by Simon6689 »

Nevermind, fixed it
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Joints and crashes

Post by slime »

What did you fix to get it to stop crashing?
User avatar
Simon6689
Prole
Posts: 7
Joined: Tue Jan 07, 2014 12:41 am

Re: Joints and crashes

Post 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.
User avatar
bdjnk
Citizen
Posts: 81
Joined: Wed Jul 03, 2013 11:44 pm

Re: Joints and crashes

Post 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 :)
User avatar
Simon6689
Prole
Posts: 7
Joined: Tue Jan 07, 2014 12:41 am

Re: Joints and crashes

Post by Simon6689 »

This is for a school project, bunny 1 was voted out, so we are going with the more normal looking one.
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests