Joint Destruction

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
Rusky
Prole
Posts: 8
Joined: Wed May 05, 2010 1:49 pm
Location: Airship Abubalay
Contact:

Joint Destruction

Post by Rusky »

Box2D takes callbacks for when joints are destroyed. Unless I'm missing something, LOVE doesn't give you a way to access this. I have a structure that should be destroyed when the joint breaks, but I can't find a way to do this.
Geti
Party member
Posts: 112
Joined: Tue Oct 20, 2009 6:38 am

Re: Joint Destruction

Post by Geti »

Code: Select all

if not joint then
self.shape:destroy()
end
?
Rusky
Prole
Posts: 8
Joined: Wed May 05, 2010 1:49 pm
Location: Airship Abubalay
Contact:

Re: Joint Destruction

Post by Rusky »

That would be a significant waste of time when Box2D can already tell you this. I was just wondering if I was missing something in the documentation.
Geti
Party member
Posts: 112
Joined: Tue Oct 20, 2009 6:38 am

Re: Joint Destruction

Post by Geti »

indeed, but this sort of check doesn't take much computational time afaik, so go with the workaround until it's exposed, i see you've added it to the tracker so if worst comes to worst, just wait for the next release..

There's also the possibility that it is exposed and not documented, if you know the function name try just using it and see if it throws an error (love.graphics.push/pop etc weren't in the graphics module wiki for quite a while, I think), though it's unlikely.
Rusky
Prole
Posts: 8
Joined: Wed May 05, 2010 1:49 pm
Location: Airship Abubalay
Contact:

Re: Joint Destruction

Post by Rusky »

Took the time to look through the source; it's not there. :( It shouldn't be to hard to add, would it work if I did it myself and submitted a patch?
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: Joint Destruction

Post by bmelts »

If you take the time to write up a patch, that might well expedite implementation. We always appreciate people doing our work for us. :neko:

Keep in mind, though - LÖVE currently uses an out-of-date version of Box2D (2.0.1, I think?), so if this is a feature that's only in newer versions, you won't have much luck exposing it until we update.
Rusky
Prole
Posts: 8
Joined: Wed May 05, 2010 1:49 pm
Location: Airship Abubalay
Contact:

Re: Joint Destruction

Post by Rusky »

Here is a patch (it's an hg bundle; you should be able to just hg pull from it):
jointudata.hg.bz2
(5.95 KiB) Downloaded 204 times
. I added Joint:get/setData, which gets passed to the new fifth callback of World:setCallbacks when Box2d gives a joint destruction notification.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 1 guest