Joint Destruction
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Joint Destruction
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.
Re: Joint Destruction
Code: Select all
if not joint then
self.shape:destroy()
end
Re: Joint Destruction
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.
Re: Joint Destruction
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.
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.
Re: Joint Destruction
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?
Re: Joint Destruction
If you take the time to write up a patch, that might well expedite implementation. We always appreciate people doing our work for us.
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.
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.
Re: Joint Destruction
Here is a patch (it's an hg bundle; you should be able to just hg pull from it):
. I added Joint:get/setData, which gets passed to the new fifth callback of World:setCallbacks when Box2d gives a joint destruction notification.Who is online
Users browsing this forum: Ahrefs [Bot] and 5 guests